Struct crossterm::style::StyledContent
source · [−]pub struct StyledContent<D: Display> { /* private fields */ }
Expand description
The style with the content to be styled.
Examples
use crossterm::style::{style, Color, Attribute, Stylize};
let styled = "Hello there"
.with(Color::Yellow)
.on(Color::Blue)
.attribute(Attribute::Bold);
println!("{}", styled);
Implementations
sourceimpl<D: Display> StyledContent<D>
impl<D: Display> StyledContent<D>
sourcepub fn new(style: ContentStyle, content: D) -> StyledContent<D>
pub fn new(style: ContentStyle, content: D) -> StyledContent<D>
Creates a new StyledContent
.
sourcepub fn style(&self) -> &ContentStyle
pub fn style(&self) -> &ContentStyle
Returns the style.
sourcepub fn style_mut(&mut self) -> &mut ContentStyle
pub fn style_mut(&mut self) -> &mut ContentStyle
Returns a mutable reference to the style, so that it can be further manipulated
Trait Implementations
sourceimpl<D: Display> AsMut<ContentStyle> for StyledContent<D>
impl<D: Display> AsMut<ContentStyle> for StyledContent<D>
sourcefn as_mut(&mut self) -> &mut ContentStyle
fn as_mut(&mut self) -> &mut ContentStyle
Converts this type into a mutable reference of the (usually inferred) input type.
sourceimpl<D: Display> AsRef<ContentStyle> for StyledContent<D>
impl<D: Display> AsRef<ContentStyle> for StyledContent<D>
sourcefn as_ref(&self) -> &ContentStyle
fn as_ref(&self) -> &ContentStyle
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl<D: Clone + Display> Clone for StyledContent<D>
impl<D: Clone + Display> Clone for StyledContent<D>
sourcefn clone(&self) -> StyledContent<D>
fn clone(&self) -> StyledContent<D>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<D: Debug + Display> Debug for StyledContent<D>
impl<D: Debug + Display> Debug for StyledContent<D>
sourceimpl<D: Display> Display for StyledContent<D>
impl<D: Display> Display for StyledContent<D>
sourceimpl<D: PartialEq + Display> PartialEq<StyledContent<D>> for StyledContent<D>
impl<D: PartialEq + Display> PartialEq<StyledContent<D>> for StyledContent<D>
sourcefn eq(&self, other: &StyledContent<D>) -> bool
fn eq(&self, other: &StyledContent<D>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &StyledContent<D>) -> bool
fn ne(&self, other: &StyledContent<D>) -> bool
This method tests for !=
.
sourceimpl<D: Display> Stylize for StyledContent<D>
impl<D: Display> Stylize for StyledContent<D>
type Styled = StyledContent<D>
type Styled = StyledContent<D>
This type with styles applied.
sourcefn underlined(self) -> Self::Styled
fn underlined(self) -> Self::Styled
Applies the Underlined
attribute to the text.
sourcefn slow_blink(self) -> Self::Styled
fn slow_blink(self) -> Self::Styled
Applies the SlowBlink
attribute to the text.
sourcefn rapid_blink(self) -> Self::Styled
fn rapid_blink(self) -> Self::Styled
Applies the RapidBlink
attribute to the text.
Applies the Hidden
attribute to the text.
sourcefn crossed_out(self) -> Self::Styled
fn crossed_out(self) -> Self::Styled
Applies the CrossedOut
attribute to the text.
sourcefn underline_black(self) -> Self::Styled
fn underline_black(self) -> Self::Styled
Sets the underline color to Black
.
sourcefn on_dark_grey(self) -> Self::Styled
fn on_dark_grey(self) -> Self::Styled
Sets the background color to DarkGrey
.
sourcefn underline_dark_grey(self) -> Self::Styled
fn underline_dark_grey(self) -> Self::Styled
Sets the underline color to DarkGrey
.
sourcefn underline_red(self) -> Self::Styled
fn underline_red(self) -> Self::Styled
Sets the underline color to Red
.
sourcefn on_dark_red(self) -> Self::Styled
fn on_dark_red(self) -> Self::Styled
Sets the background color to DarkRed
.
sourcefn underline_dark_red(self) -> Self::Styled
fn underline_dark_red(self) -> Self::Styled
Sets the underline color to DarkRed
.
sourcefn underline_green(self) -> Self::Styled
fn underline_green(self) -> Self::Styled
Sets the underline color to Green
.
sourcefn dark_green(self) -> Self::Styled
fn dark_green(self) -> Self::Styled
Sets the foreground color to DarkGreen
.
sourcefn on_dark_green(self) -> Self::Styled
fn on_dark_green(self) -> Self::Styled
Sets the background color to DarkGreen
.
sourcefn underline_dark_green(self) -> Self::Styled
fn underline_dark_green(self) -> Self::Styled
Sets the underline color to DarkGreen
.
sourcefn underline_yellow(self) -> Self::Styled
fn underline_yellow(self) -> Self::Styled
Sets the underline color to Yellow
.
sourcefn dark_yellow(self) -> Self::Styled
fn dark_yellow(self) -> Self::Styled
Sets the foreground color to DarkYellow
.
sourcefn on_dark_yellow(self) -> Self::Styled
fn on_dark_yellow(self) -> Self::Styled
Sets the background color to DarkYellow
.
sourcefn underline_dark_yellow(self) -> Self::Styled
fn underline_dark_yellow(self) -> Self::Styled
Sets the underline color to DarkYellow
.
sourcefn underline_blue(self) -> Self::Styled
fn underline_blue(self) -> Self::Styled
Sets the underline color to Blue
.
sourcefn on_dark_blue(self) -> Self::Styled
fn on_dark_blue(self) -> Self::Styled
Sets the background color to DarkBlue
.
sourcefn underline_dark_blue(self) -> Self::Styled
fn underline_dark_blue(self) -> Self::Styled
Sets the underline color to DarkBlue
.
sourcefn on_magenta(self) -> Self::Styled
fn on_magenta(self) -> Self::Styled
Sets the background color to Magenta
.
sourcefn underline_magenta(self) -> Self::Styled
fn underline_magenta(self) -> Self::Styled
Sets the underline color to Magenta
.
sourcefn dark_magenta(self) -> Self::Styled
fn dark_magenta(self) -> Self::Styled
Sets the foreground color to DarkMagenta
.
sourcefn on_dark_magenta(self) -> Self::Styled
fn on_dark_magenta(self) -> Self::Styled
Sets the background color to DarkMagenta
.
sourcefn underline_dark_magenta(self) -> Self::Styled
fn underline_dark_magenta(self) -> Self::Styled
Sets the underline color to DarkMagenta
.
sourcefn underline_cyan(self) -> Self::Styled
fn underline_cyan(self) -> Self::Styled
Sets the underline color to Cyan
.
sourcefn on_dark_cyan(self) -> Self::Styled
fn on_dark_cyan(self) -> Self::Styled
Sets the background color to DarkCyan
.
sourcefn underline_dark_cyan(self) -> Self::Styled
fn underline_dark_cyan(self) -> Self::Styled
Sets the underline color to DarkCyan
.
sourcefn underline_white(self) -> Self::Styled
fn underline_white(self) -> Self::Styled
Sets the underline color to White
.
sourcefn underline_grey(self) -> Self::Styled
fn underline_grey(self) -> Self::Styled
Sets the underline color to Grey
.
impl<D: Copy + Display> Copy for StyledContent<D>
impl<D: Eq + Display> Eq for StyledContent<D>
impl<D: Display> StructuralEq for StyledContent<D>
impl<D: Display> StructuralPartialEq for StyledContent<D>
Auto Trait Implementations
impl<D> RefUnwindSafe for StyledContent<D> where
D: RefUnwindSafe,
impl<D> Send for StyledContent<D> where
D: Send,
impl<D> Sync for StyledContent<D> where
D: Sync,
impl<D> Unpin for StyledContent<D> where
D: Unpin,
impl<D> UnwindSafe for StyledContent<D> where
D: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more