Struct term_painter::Style

source ·
pub struct Style {
    pub fg: Color,
    pub bg: Color,
    /* private fields */
}
Expand description

Saves all properties of a style. Implements ToStyle, so you can call style modifiers on it.

Fields§

§fg: Color§bg: Color

Implementations§

source§

impl Style

source

pub fn get_bold(&self) -> Option<bool>

source

pub fn set_bold(&mut self, v: Option<bool>)

source

pub fn get_dim(&self) -> Option<bool>

source

pub fn set_dim(&mut self, v: Option<bool>)

source

pub fn get_underline(&self) -> Option<bool>

source

pub fn set_underline(&mut self, v: Option<bool>)

source

pub fn get_reverse(&self) -> Option<bool>

source

pub fn set_reverse(&mut self, v: Option<bool>)

source

pub fn get_secure(&self) -> Option<bool>

source

pub fn set_secure(&mut self, v: Option<bool>)

Trait Implementations§

source§

impl Clone for Style

source§

fn clone(&self) -> Style

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 Style

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 PartialEq for Style

source§

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

source§

fn to_style(self) -> Style

Dummy implementation that just returns self.

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 Style

source§

impl Eq for Style

source§

impl StructuralPartialEq for Style

Auto Trait Implementations§

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnwindSafe for Style

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.