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§
Source§impl<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§
Source§impl<D: Display> AsMut<ContentStyle> for StyledContent<D>
 
impl<D: Display> AsMut<ContentStyle> for StyledContent<D>
Source§fn 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.
Source§impl<D: Display> AsRef<ContentStyle> for StyledContent<D>
 
impl<D: Display> AsRef<ContentStyle> for StyledContent<D>
Source§fn as_ref(&self) -> &ContentStyle
 
fn as_ref(&self) -> &ContentStyle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<D: Clone + Display> Clone for StyledContent<D>
 
impl<D: Clone + Display> Clone for StyledContent<D>
Source§fn clone(&self) -> StyledContent<D>
 
fn clone(&self) -> StyledContent<D>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moreSource§impl<D: Display> Display for StyledContent<D>
 
impl<D: Display> Display for StyledContent<D>
Source§impl<D: Display> Stylize for StyledContent<D>
 
impl<D: Display> Stylize for StyledContent<D>
Source§type Styled = StyledContent<D>
 
type Styled = StyledContent<D>
This type with styles applied.
Source§fn underlined(self) -> Self::Styled
 
fn underlined(self) -> Self::Styled
Applies the 
Underlined attribute to the text.Source§fn slow_blink(self) -> Self::Styled
 
fn slow_blink(self) -> Self::Styled
Applies the 
SlowBlink attribute to the text.Source§fn 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.Source§fn crossed_out(self) -> Self::Styled
 
fn crossed_out(self) -> Self::Styled
Applies the 
CrossedOut attribute to the text.Source§fn underline_black(self) -> Self::Styled
 
fn underline_black(self) -> Self::Styled
Sets the underline color to 
Black.Source§fn on_dark_grey(self) -> Self::Styled
 
fn on_dark_grey(self) -> Self::Styled
Sets the background color to 
DarkGrey.Source§fn underline_dark_grey(self) -> Self::Styled
 
fn underline_dark_grey(self) -> Self::Styled
Sets the underline color to 
DarkGrey.Source§fn underline_red(self) -> Self::Styled
 
fn underline_red(self) -> Self::Styled
Sets the underline color to 
Red.Source§fn on_dark_red(self) -> Self::Styled
 
fn on_dark_red(self) -> Self::Styled
Sets the background color to 
DarkRed.Source§fn underline_dark_red(self) -> Self::Styled
 
fn underline_dark_red(self) -> Self::Styled
Sets the underline color to 
DarkRed.Source§fn underline_green(self) -> Self::Styled
 
fn underline_green(self) -> Self::Styled
Sets the underline color to 
Green.Source§fn dark_green(self) -> Self::Styled
 
fn dark_green(self) -> Self::Styled
Sets the foreground color to 
DarkGreen.Source§fn on_dark_green(self) -> Self::Styled
 
fn on_dark_green(self) -> Self::Styled
Sets the background color to 
DarkGreen.Source§fn underline_dark_green(self) -> Self::Styled
 
fn underline_dark_green(self) -> Self::Styled
Sets the underline color to 
DarkGreen.Source§fn underline_yellow(self) -> Self::Styled
 
fn underline_yellow(self) -> Self::Styled
Sets the underline color to 
Yellow.Source§fn dark_yellow(self) -> Self::Styled
 
fn dark_yellow(self) -> Self::Styled
Sets the foreground color to 
DarkYellow.Source§fn on_dark_yellow(self) -> Self::Styled
 
fn on_dark_yellow(self) -> Self::Styled
Sets the background color to 
DarkYellow.Source§fn underline_dark_yellow(self) -> Self::Styled
 
fn underline_dark_yellow(self) -> Self::Styled
Sets the underline color to 
DarkYellow.Source§fn underline_blue(self) -> Self::Styled
 
fn underline_blue(self) -> Self::Styled
Sets the underline color to 
Blue.Source§fn on_dark_blue(self) -> Self::Styled
 
fn on_dark_blue(self) -> Self::Styled
Sets the background color to 
DarkBlue.Source§fn underline_dark_blue(self) -> Self::Styled
 
fn underline_dark_blue(self) -> Self::Styled
Sets the underline color to 
DarkBlue.Source§fn on_magenta(self) -> Self::Styled
 
fn on_magenta(self) -> Self::Styled
Sets the background color to 
Magenta.Source§fn underline_magenta(self) -> Self::Styled
 
fn underline_magenta(self) -> Self::Styled
Sets the underline color to 
Magenta.Source§fn dark_magenta(self) -> Self::Styled
 
fn dark_magenta(self) -> Self::Styled
Sets the foreground color to 
DarkMagenta.Source§fn on_dark_magenta(self) -> Self::Styled
 
fn on_dark_magenta(self) -> Self::Styled
Sets the background color to 
DarkMagenta.Source§fn underline_dark_magenta(self) -> Self::Styled
 
fn underline_dark_magenta(self) -> Self::Styled
Sets the underline color to 
DarkMagenta.Source§fn underline_cyan(self) -> Self::Styled
 
fn underline_cyan(self) -> Self::Styled
Sets the underline color to 
Cyan.Source§fn on_dark_cyan(self) -> Self::Styled
 
fn on_dark_cyan(self) -> Self::Styled
Sets the background color to 
DarkCyan.Source§fn underline_dark_cyan(self) -> Self::Styled
 
fn underline_dark_cyan(self) -> Self::Styled
Sets the underline color to 
DarkCyan.Source§fn underline_white(self) -> Self::Styled
 
fn underline_white(self) -> Self::Styled
Sets the underline color to 
White.Source§fn 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> StructuralPartialEq for StyledContent<D>
Auto Trait Implementations§
impl<D> Freeze for StyledContent<D>where
    D: Freeze,
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§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more