Struct andiskaz::style::Style

source ·
pub struct Style<C = Color2>where
    C: Updater,{
    pub left_margin: Coord,
    pub right_margin: Coord,
    pub top_margin: Coord,
    pub bottom_margin: Coord,
    pub min_width: Coord,
    pub max_width: Coord,
    pub min_height: Coord,
    pub max_height: Coord,
    pub align_numer: Coord,
    pub align_denom: Coord,
    pub colors: C,
}
Expand description

Alignment, margin and other settings for texts.

Fields§

§left_margin: Coord

Left margin.

§right_margin: Coord

Right margin.

§top_margin: Coord

Top margin.

§bottom_margin: Coord

Bottom margin.

§min_width: Coord

Minimum width.

§max_width: Coord

Maximum width.

§min_height: Coord

Minimum height.

§max_height: Coord

Maximum height.

§align_numer: Coord

Alignment align_numererator.

§align_denom: Coord

Alignment align_denomominator.

§colors: C

Foreground-background color pair.

Implementations§

source§

impl<C> Style<C>where C: Updater,

source

pub fn with_colors(colors: C) -> Self

Creates a style with the given colors.

source

pub fn colors<D>(self, colors: D) -> Style<D>where D: Updater,

Updates the style to the given color updater.

source

pub fn left_margin(self, left_margin: Coord) -> Self

Sets left margin.

source

pub fn right_margin(self, right_margin: Coord) -> Self

Sets right margin.

source

pub fn top_margin(self, top_margin: Coord) -> Self

Sets top margin.

source

pub fn bottom_margin(self, bottom_margin: Coord) -> Self

Sets bottom margin.

source

pub fn min_width(self, min_width: Coord) -> Self

Sets minimum width.

source

pub fn max_width(self, max_width: Coord) -> Self

Sets maximum width.

source

pub fn min_height(self, min_height: Coord) -> Self

Sets minimum height.

source

pub fn max_height(self, max_height: Coord) -> Self

Sets maximum height.

source

pub fn align(self, align_numer: Coord, align_denom: Coord) -> Self

Sets alignment. Numerator and align_denomominator are used such that line\[index\] * align_numer / align_denom == screen\[index\]

source

pub fn make_margin_below(&self) -> Vec2

Makes a coordinate pair that contains the margin dimensions that are “less”.

source

pub fn make_margin_above(&self) -> Vec2

Makes a coordinate pair that contains the margin dimensions that are “greater”.

source

pub fn make_min_size(&self) -> Vec2

Makes a coordinate pair that contains the minima sizes.

source

pub fn make_max_size(&self) -> Vec2

Makes a coordinate pair that contains the maxima sizes.

source

pub fn make_size(&self, screen_size: Vec2) -> Vec2

Makes a coordinate pair that contains the actual sizes.

Trait Implementations§

source§

impl<C> Clone for Style<C>where C: Updater + Clone,

source§

fn clone(&self) -> Style<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C> Debug for Style<C>where C: Updater + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Style

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<C> Hash for Style<C>where C: Updater + Hash,

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<C> PartialEq<Style<C>> for Style<C>where C: Updater + PartialEq,

source§

fn eq(&self, other: &Style<C>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<C> Copy for Style<C>where C: Updater + Copy,

source§

impl<C> Eq for Style<C>where C: Updater + Eq,

source§

impl<C> StructuralEq for Style<C>where C: Updater,

source§

impl<C> StructuralPartialEq for Style<C>where C: Updater,

Auto Trait Implementations§

§

impl<C> RefUnwindSafe for Style<C>where C: RefUnwindSafe,

§

impl<C> Send for Style<C>where C: Send,

§

impl<C> Sync for Style<C>where C: Sync,

§

impl<C> Unpin for Style<C>where C: Unpin,

§

impl<C> UnwindSafe for Style<C>where C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast for Twhere T: Any,

source§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Sync + Send, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.