[][src]Struct colored::ColoredString

pub struct ColoredString { /* fields omitted */ }

A string that may have color and/or style applied to it.

Implementations

impl ColoredString[src]

pub fn fgcolor(&self) -> Option<Color>[src]

Get the current background color applied.

let cstr = "".blue();
assert_eq!(cstr.fgcolor(), Some(Color::Blue));
let cstr = cstr.clear();
assert_eq!(cstr.fgcolor(), None);

pub fn bgcolor(&self) -> Option<Color>[src]

Get the current background color applied.

let cstr = "".on_blue();
assert_eq!(cstr.bgcolor(), Some(Color::Blue));
let cstr = cstr.clear();
assert_eq!(cstr.bgcolor(), None);

pub fn style(&self) -> Style[src]

Get the current Style which can be check if it contains a Styles.

let colored = "".bold().italic();
assert_eq!(colored.style().contains(Styles::Bold), true);
assert_eq!(colored.style().contains(Styles::Italic), true);
assert_eq!(colored.style().contains(Styles::Dimmed), false);

pub fn is_plain(&self) -> bool[src]

Checks if the colored string has no color or styling.

let cstr = "".red();
assert_eq!(cstr.is_plain(), false);
let cstr = cstr.clear();
assert_eq!(cstr.is_plain(), true);

Trait Implementations

impl Clone for ColoredString[src]

impl Colorize for ColoredString[src]

impl Debug for ColoredString[src]

impl Default for ColoredString[src]

impl Deref for ColoredString[src]

type Target = str

The resulting type after dereferencing.

impl Display for ColoredString[src]

impl Eq for ColoredString[src]

impl<'a> From<&'a str> for ColoredString[src]

impl PartialEq<ColoredString> for ColoredString[src]

impl StructuralEq for ColoredString[src]

impl StructuralPartialEq for ColoredString[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.