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
Performs the conversion.
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
Performs the conversion.
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 on_dark_grey(self) -> Self::Styled
fn on_dark_grey(self) -> Self::Styled
Sets the background color to DarkGrey
.
sourcefn on_dark_red(self) -> Self::Styled
fn on_dark_red(self) -> Self::Styled
Sets the background color to DarkRed
.
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 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 on_dark_blue(self) -> Self::Styled
fn on_dark_blue(self) -> Self::Styled
Sets the background color to DarkBlue
.
sourcefn on_magenta(self) -> Self::Styled
fn on_magenta(self) -> Self::Styled
Sets the background 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 on_dark_cyan(self) -> Self::Styled
fn on_dark_cyan(self) -> Self::Styled
Sets the background color to DarkCyan
.
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more