pub trait StyledText: Sized {
Show 63 methods
// Required methods
fn s<T: Display>(self, s: T) -> Self;
fn reset(self) -> Self;
fn repeat<T: Display>(self, s: T, n: usize) -> Self;
fn plural<T: Display>(self, s: T, n: usize) -> Self;
fn align_left<T: Display>(self, s: T, width: usize) -> Self;
fn align_right<T: Display>(self, s: T, width: usize) -> Self;
fn align_center<T: Display>(self, s: T, width: usize) -> Self;
fn pad<T: Display>(self, ch: char, padding: usize, s: T) -> Self;
fn pad_left<T: Display>(self, ch: char, s: T, width: usize) -> Self;
fn pad_right<T: Display>(self, ch: char, s: T, width: usize) -> Self;
fn pad_center<T: Display>(self, ch: char, s: T, width: usize) -> Self;
fn fill(self, ch: char, width: usize) -> Self;
fn choose<T: Display, F: Display>(
self,
condition: bool,
when_true: T,
when_false: F,
) -> Self;
fn matches<C: IntoIterator<Item = (bool, impl Display)>>(
self,
conditions: C,
) -> Self;
fn indent<T: Display>(self, indent: usize, s: T) -> Self;
fn bold(self) -> Self;
fn italic(self) -> Self;
fn underline(self) -> Self;
fn black(self) -> Self;
fn bright_black(self) -> Self;
fn red(self) -> Self;
fn bright_red(self) -> Self;
fn green(self) -> Self;
fn bright_green(self) -> Self;
fn yellow(self) -> Self;
fn bright_yellow(self) -> Self;
fn blue(self) -> Self;
fn bright_blue(self) -> Self;
fn magenta(self) -> Self;
fn bright_magenta(self) -> Self;
fn cyan(self) -> Self;
fn bright_cyan(self) -> Self;
fn white(self) -> Self;
fn bright_white(self) -> Self;
fn bg_black(self) -> Self;
fn bg_bright_black(self) -> Self;
fn bg_red(self) -> Self;
fn bg_bright_red(self) -> Self;
fn bg_green(self) -> Self;
fn bg_bright_green(self) -> Self;
fn bg_yellow(self) -> Self;
fn bg_bright_yellow(self) -> Self;
fn bg_blue(self) -> Self;
fn bg_bright_blue(self) -> Self;
fn bg_magenta(self) -> Self;
fn bg_bright_magenta(self) -> Self;
fn bg_cyan(self) -> Self;
fn bg_bright_cyan(self) -> Self;
fn bg_white(self) -> Self;
fn bg_bright_white(self) -> Self;
fn color(self, c: Color) -> Self;
fn bright_color(self, c: Color) -> Self;
fn bg_color(self, c: Color) -> Self;
fn bg_bright_color(self, c: Color) -> Self;
fn color_8(self, c: u8) -> Self;
fn bright_color_8(self, c: u8) -> Self;
fn bg_color_8(self, c: u8) -> Self;
fn bg_bright_color_8(self, c: u8) -> Self;
fn color_256(self, c: u8) -> Self;
fn bg_color_256(self, c: u8) -> Self;
fn color_rgb(self, c: RgbColor) -> Self;
fn bg_color_rgb(self, c: RgbColor) -> Self;
// Provided method
fn r<T: Display>(self, s: T) -> Self { ... }
}Expand description
A trait representing styled text.
Required Methods§
Sourcefn plural<T: Display>(self, s: T, n: usize) -> Self
fn plural<T: Display>(self, s: T, n: usize) -> Self
Adds s suffix to the content when the number is not 1.
Sourcefn align_left<T: Display>(self, s: T, width: usize) -> Self
fn align_left<T: Display>(self, s: T, width: usize) -> Self
Adds the content aligned left with specified width.
Sourcefn align_right<T: Display>(self, s: T, width: usize) -> Self
fn align_right<T: Display>(self, s: T, width: usize) -> Self
Adds the content aligned right with specified width.
Sourcefn align_center<T: Display>(self, s: T, width: usize) -> Self
fn align_center<T: Display>(self, s: T, width: usize) -> Self
Adds the content centered with specified width.
Sourcefn pad<T: Display>(self, ch: char, padding: usize, s: T) -> Self
fn pad<T: Display>(self, ch: char, padding: usize, s: T) -> Self
Pads the content with specified character.
Sourcefn pad_left<T: Display>(self, ch: char, s: T, width: usize) -> Self
fn pad_left<T: Display>(self, ch: char, s: T, width: usize) -> Self
Pads the content aligned the left with specified width.
Sourcefn pad_right<T: Display>(self, ch: char, s: T, width: usize) -> Self
fn pad_right<T: Display>(self, ch: char, s: T, width: usize) -> Self
Pads the content aligned right with specified width.
Sourcefn pad_center<T: Display>(self, ch: char, s: T, width: usize) -> Self
fn pad_center<T: Display>(self, ch: char, s: T, width: usize) -> Self
Pads the content centered with specified width.
Sourcefn fill(self, ch: char, width: usize) -> Self
fn fill(self, ch: char, width: usize) -> Self
Fills the content with the given character until the given width is reached.
Sourcefn choose<T: Display, F: Display>(
self,
condition: bool,
when_true: T,
when_false: F,
) -> Self
fn choose<T: Display, F: Display>( self, condition: bool, when_true: T, when_false: F, ) -> Self
Adds new content based on the condition.
Sourcefn matches<C: IntoIterator<Item = (bool, impl Display)>>(
self,
conditions: C,
) -> Self
fn matches<C: IntoIterator<Item = (bool, impl Display)>>( self, conditions: C, ) -> Self
Adds new content based on the first matching condition.
Sourcefn bright_black(self) -> Self
fn bright_black(self) -> Self
Sets the foreground color to bright black.
Sourcefn bright_red(self) -> Self
fn bright_red(self) -> Self
Sets the foreground color to bright red.
Sourcefn bright_green(self) -> Self
fn bright_green(self) -> Self
Sets the foreground color to bright green.
Sourcefn bright_yellow(self) -> Self
fn bright_yellow(self) -> Self
Sets the foreground color to bright yellow.
Sourcefn bright_blue(self) -> Self
fn bright_blue(self) -> Self
Sets the foreground color to bright blue.
Sourcefn bright_magenta(self) -> Self
fn bright_magenta(self) -> Self
Sets the foreground color to bright magenta.
Sourcefn bright_cyan(self) -> Self
fn bright_cyan(self) -> Self
Sets the foreground color to bright cyan.
Sourcefn bright_white(self) -> Self
fn bright_white(self) -> Self
Sets the foreground color to bright white.
Sourcefn bg_bright_black(self) -> Self
fn bg_bright_black(self) -> Self
Sets the background color to bright black.
Sourcefn bg_bright_red(self) -> Self
fn bg_bright_red(self) -> Self
Sets the background color to bright red.
Sourcefn bg_bright_green(self) -> Self
fn bg_bright_green(self) -> Self
Sets the background color to bright green.
Sourcefn bg_bright_yellow(self) -> Self
fn bg_bright_yellow(self) -> Self
Sets the background color to bright yellow.
Sourcefn bg_bright_blue(self) -> Self
fn bg_bright_blue(self) -> Self
Sets the background color to bright blue.
Sourcefn bg_magenta(self) -> Self
fn bg_magenta(self) -> Self
Sets the background color to magenta.
Sourcefn bg_bright_magenta(self) -> Self
fn bg_bright_magenta(self) -> Self
Sets the background color to bright magenta.
Sourcefn bg_bright_cyan(self) -> Self
fn bg_bright_cyan(self) -> Self
Sets the background color to bright cyan.
Sourcefn bg_bright_white(self) -> Self
fn bg_bright_white(self) -> Self
Sets the background color to bright white.
Sourcefn bright_color(self, c: Color) -> Self
fn bright_color(self, c: Color) -> Self
Sets the bright color by color enumeration.
Sourcefn bg_bright_color(self, c: Color) -> Self
fn bg_bright_color(self, c: Color) -> Self
Sets the background bright color by color enumeration.
Sourcefn bright_color_8(self, c: u8) -> Self
fn bright_color_8(self, c: u8) -> Self
Sets the bright color by color index.
Sourcefn bg_color_8(self, c: u8) -> Self
fn bg_color_8(self, c: u8) -> Self
Sets the background color by color index.
Sourcefn bg_bright_color_8(self, c: u8) -> Self
fn bg_bright_color_8(self, c: u8) -> Self
Sets the background bright color by color index.
fn color_256(self, c: u8) -> Self
fn bg_color_256(self, c: u8) -> Self
fn color_rgb(self, c: RgbColor) -> Self
fn bg_color_rgb(self, c: RgbColor) -> Self
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".