nu_ansi_term

Type Alias 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 nu_ansi_term::AnsiString;
use nu_ansi_term::Color::Red;

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

let plain_string = AnsiString::from("a plain string");

Aliased Type§

struct AnsiString<'a> { /* private fields */ }

Trait Implementations§

Source§

impl<'a> Display for AnsiString<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 40 bytes