[][src]Struct crossterm_style::StyledObject

pub struct StyledObject<D: Display + Clone> {
    pub object_style: ObjectStyle,
    pub content: D,
}

A styled object.

Examples

use crossterm_style::{style, Color, Attribute};

let styled = style("Hello there")
    .with(Color::Yellow)
    .on(Color::Blue)
    .attr(Attribute::Bold);

println!("{}", styled);

Fields

object_style: ObjectStyle

The object style (colors, content attributes).

content: D

An object to apply the style on.

Methods

impl<'a, D: Display + 'a + Clone> StyledObject<D>[src]

pub fn with(self, foreground_color: Color) -> StyledObject<D>[src]

Sets the foreground color.

pub fn on(self, background_color: Color) -> StyledObject<D>[src]

Sets the background color.

pub fn attr(self, attr: Attribute) -> StyledObject<D>[src]

Adds the attribute.

You can add more attributes by calling this method multiple times.

Trait Implementations

impl<D: Display + Clone> Colorize<D> for StyledObject<D>[src]

impl<D: Display + Clone> Styler<D> for StyledObject<D>[src]

impl<D: Clone + Display> Clone for StyledObject<D>[src]

impl<D: Display + Clone> Display for StyledObject<D>[src]

Auto Trait Implementations

impl<D> Send for StyledObject<D> where
    D: Send

impl<D> Sync for StyledObject<D> where
    D: Sync

impl<D> Unpin for StyledObject<D> where
    D: Unpin

impl<D> UnwindSafe for StyledObject<D> where
    D: UnwindSafe

impl<D> RefUnwindSafe for StyledObject<D> where
    D: RefUnwindSafe

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

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

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

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