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§
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 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> Display for StyledContent<D>
impl<D: Display> Display for StyledContent<D>
source§impl<D: PartialEq + Display> PartialEq for StyledContent<D>
impl<D: PartialEq + Display> PartialEq for StyledContent<D>
source§fn 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 ==
.source§impl<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.
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