Struct termimad::crossterm::style::StyledContent
source · pub struct StyledContent<D>where
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> StyledContent<D>where
D: Display,
impl<D> StyledContent<D>where
D: Display,
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> AsMut<ContentStyle> for StyledContent<D>where
D: Display,
impl<D> AsMut<ContentStyle> for StyledContent<D>where
D: Display,
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> AsRef<ContentStyle> for StyledContent<D>where
D: Display,
impl<D> AsRef<ContentStyle> for StyledContent<D>where
D: Display,
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 for StyledContent<D>where
D: Clone + Display,
impl<D> Clone for StyledContent<D>where
D: Clone + Display,
source§fn clone(&self) -> StyledContent<D>
fn clone(&self) -> StyledContent<D>
Returns a copy 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 for StyledContent<D>where
D: Display,
impl<D> Display for StyledContent<D>where
D: Display,
source§impl<D> PartialEq<StyledContent<D>> for StyledContent<D>where
D: PartialEq<D> + Display,
impl<D> PartialEq<StyledContent<D>> for StyledContent<D>where
D: PartialEq<D> + Display,
source§fn eq(&self, other: &StyledContent<D>) -> bool
fn eq(&self, other: &StyledContent<D>) -> bool
source§impl<D> Stylize for StyledContent<D>where
D: Display,
impl<D> Stylize for StyledContent<D>where
D: Display,
§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 on_dark_grey(self) -> Self::Styled
fn on_dark_grey(self) -> Self::Styled
Sets the background color to
DarkGrey
.source§fn on_dark_red(self) -> Self::Styled
fn on_dark_red(self) -> Self::Styled
Sets the background color to
DarkRed
.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 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 on_dark_blue(self) -> Self::Styled
fn on_dark_blue(self) -> Self::Styled
Sets the background color to
DarkBlue
.source§fn on_magenta(self) -> Self::Styled
fn on_magenta(self) -> Self::Styled
Sets the background 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 on_dark_cyan(self) -> Self::Styled
fn on_dark_cyan(self) -> Self::Styled
Sets the background color to
DarkCyan
.