[][src]Struct tuikit::attr::Attr

pub struct Attr {
    pub fg: Color,
    pub bg: Color,
    pub effect: Effect,
}

Attr is a rendering attribute that contains fg color, bg color and text effect.

use tuikit::attr::{Attr, Effect, Color};

let attr = Attr { fg: Color::RED, effect: Effect::BOLD, ..Attr::default() };

Fields

fg: Colorbg: Coloreffect: Effect

Implementations

impl Attr[src]

pub fn extend(&self, new_attr: Self) -> Attr[src]

extend the properties with the new attr's if the properties in new attr is not default.

use tuikit::attr::{Attr, Color, Effect};

let default = Attr{fg: Color::BLUE, bg: Color::YELLOW, effect: Effect::BOLD};
let new = Attr{fg: Color::Default, bg: Color::WHITE, effect: Effect::REVERSE};
let extended = default.extend(new);

assert_eq!(Color::BLUE, extended.fg);
assert_eq!(Color::WHITE, extended.bg);
assert_eq!(Effect::BOLD | Effect::REVERSE, extended.effect);

pub fn fg(self, fg: Color) -> Self[src]

pub fn bg(self, bg: Color) -> Self[src]

pub fn effect(self, effect: Effect) -> Self[src]

Trait Implementations

impl Clone for Attr[src]

impl Copy for Attr[src]

impl Debug for Attr[src]

impl Default for Attr[src]

impl From<Color> for Attr[src]

impl From<Effect> for Attr[src]

impl PartialEq<Attr> for Attr[src]

impl StructuralPartialEq for Attr[src]

Auto Trait Implementations

impl RefUnwindSafe for Attr

impl Send for Attr

impl Sync for Attr

impl Unpin for Attr

impl UnwindSafe for Attr

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.