Struct colored::ColoredString [−][src]
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]
fn clone(&self) -> ColoredString
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Colorize for ColoredString
[src]
fn color<S: Into<Color>>(self, color: S) -> ColoredString
[src]
fn on_color<S: Into<Color>>(self, color: S) -> ColoredString
[src]
fn clear(self) -> ColoredString
[src]
fn normal(self) -> ColoredString
[src]
fn bold(self) -> ColoredString
[src]
fn dimmed(self) -> ColoredString
[src]
fn italic(self) -> ColoredString
[src]
fn underline(self) -> ColoredString
[src]
fn blink(self) -> ColoredString
[src]
fn reverse(self) -> ColoredString
[src]
fn reversed(self) -> ColoredString
[src]
fn hidden(self) -> ColoredString
[src]
fn strikethrough(self) -> ColoredString
[src]
fn black(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn red(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn green(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn yellow(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn blue(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn magenta(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn purple(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn cyan(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn white(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_black(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_red(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_green(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_yellow(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_blue(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_magenta(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_purple(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_cyan(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn bright_white(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_black(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_red(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_green(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_yellow(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_blue(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_magenta(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_purple(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_cyan(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_white(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_black(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_red(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_green(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_yellow(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_blue(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_magenta(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_purple(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_cyan(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
fn on_bright_white(self) -> ColoredString where
Self: Sized,
[src]
Self: Sized,
impl Debug for ColoredString
[src]
impl Default for ColoredString
[src]
impl Deref for ColoredString
[src]
impl Display for ColoredString
[src]
impl Eq for ColoredString
[src]
impl<'a> From<&'a str> for ColoredString
[src]
impl PartialEq<ColoredString> for ColoredString
[src]
fn eq(&self, other: &ColoredString) -> bool
[src]
fn ne(&self, other: &ColoredString) -> bool
[src]
impl StructuralEq for ColoredString
[src]
impl StructuralPartialEq for ColoredString
[src]
Auto Trait Implementations
impl RefUnwindSafe for ColoredString
impl Send for ColoredString
impl Sync for ColoredString
impl Unpin for ColoredString
impl UnwindSafe for ColoredString
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,