Enum term_painter::Attr

source ·
pub enum Attr {
    Plain,
    Bold,
    Dim,
    Underline,
    Blink,
    Reverse,
    Secure,
}
Expand description

Lists possible attributes. It implements ToStyle so it’s possible to call ToStyle’s methods directly on a Attr variant like:


println!("{}", Attr::Bold.fg(Color::Red).paint("Red and bold"));

It is not guaranteed that the local terminal supports all of those formatting options. As already mentioned in the module documentation, you should use term directly to check the terminal’s capabilities.

For more information about enum variants, see term::Attr Documentation.

Variants§

§

Plain

Just default style

§

Bold

§

Dim

§

Underline

§

Reverse

§

Secure

Trait Implementations§

source§

impl Clone for Attr

source§

fn clone(&self) -> Attr

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 Debug for Attr

source§

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

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

impl PartialEq for Attr

source§

fn eq(&self, other: &Attr) -> 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 ToStyle for Attr

source§

fn to_style(self) -> Style

Returns a Style with default values and the self attribute enabled.

source§

fn to_mapped_style<F>(self, func: F) -> Style
where F: FnOnce(&mut Style),

Convenience method for modifying the style before it’s returned.
source§

fn fg(self, c: Color) -> Style

Sets the foreground (text) color.
source§

fn bg(self, c: Color) -> Style

Sets the background color.
source§

fn bold(self) -> Style

Makes the text bold.
source§

fn dim(self) -> Style

Dim mode.
source§

fn underline(self) -> Style

Underlines the text.
source§

fn not_underline(self) -> Style

Removes underline-attribute.
Underlines the text.
source§

fn reverse(self) -> Style

Underlines the text.
source§

fn secure(self) -> Style

Secure mode.
source§

fn paint<T>(&self, obj: T) -> Painted<T>
where Self: Clone,

Wraps the style specified in self and something of arbitrary type into a Painted. When Painted is printed it will print the arbitrary something with the given style.
source§

fn with<F, R>(&self, f: F) -> R
where F: FnOnce() -> R, Self: Clone,

Executes the given function, applying the style information before calling it and resetting after it finished.
source§

impl Copy for Attr

source§

impl Eq for Attr

source§

impl StructuralPartialEq for Attr

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§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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 T
where 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 T
where 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 T
where 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.