Type Definition ansi_term::ANSIString

source · []
pub type ANSIString<'a> = ANSIGenericString<'a, str>;
Expand description

An ANSI String is a string coupled with the Style to display it in a terminal.

Although not technically a string itself, it can be turned into one with the to_string method.

Examples

use ansi_term::ANSIString;
use ansi_term::Colour::Red;

let red_string = Red.paint("a red string");
println!("{}", red_string);
use ansi_term::ANSIString;

let plain_string = ANSIString::from("a plain string");
assert_eq!(&*plain_string, "a plain string");

Trait Implementations

Formats the value using the given formatter. Read more