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");
Aliased Type§
struct ANSIString<'a> { /* private fields */ }
Implementations
Trait Implementations§
Source§impl<'a> Display for ANSIString<'a>
impl<'a> Display for ANSIString<'a>
Source§impl<'a, S: 'a + ToOwned + ?Sized> Clone for ANSIGenericString<'a, S>
Cloning an ANSIGenericString
will clone its underlying string.
impl<'a, S: 'a + ToOwned + ?Sized> Clone for ANSIGenericString<'a, S>
Cloning an ANSIGenericString
will clone its underlying string.
§Examples
use ansi_term::ANSIString;
let plain_string = ANSIString::from("a plain string");
let clone_string = plain_string.clone();
assert_eq!(clone_string, plain_string);
Source§fn clone(&self) -> ANSIGenericString<'a, S>
fn clone(&self) -> ANSIGenericString<'a, S>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a, I, S: 'a + ToOwned + ?Sized> From<I> for ANSIGenericString<'a, S>
impl<'a, I, S: 'a + ToOwned + ?Sized> From<I> for ANSIGenericString<'a, S>
Source§fn from(input: I) -> ANSIGenericString<'a, S>
fn from(input: I) -> ANSIGenericString<'a, S>
Converts to this type from the input type.