Type Alias ANSIByteString

Source
pub type ANSIByteString<'a> = ANSIGenericString<'a, [u8]>;
Expand description

An ANSIByteString represents a formatted series of bytes. Use ANSIByteString when styling text with an unknown encoding.

Aliased Type§

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

Implementations§

Source§

impl<'a> ANSIByteString<'a>

Source

pub fn write_to<W: Write>(&self, w: &mut W) -> Result<()>

Write an ANSIByteString to an io::Write. This writes the escape sequences for the associated Style around the bytes.

Source§

impl<'a, S: 'a + ToOwned + ?Sized> ANSIGenericString<'a, S>
where <S as ToOwned>::Owned: Debug,

Source

pub fn style_ref(&self) -> &Style

Directly access the style

Source

pub fn style_ref_mut(&mut self) -> &mut Style

Directly access the style mutably

Trait Implementations

Source§

impl<'a, S: 'a + ToOwned + ?Sized> Clone for ANSIGenericString<'a, S>
where <S as ToOwned>::Owned: Debug,

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>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, S: Debug + 'a + ToOwned + ?Sized> Debug for ANSIGenericString<'a, S>
where <S as ToOwned>::Owned: Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a, S: 'a + ToOwned + ?Sized> Deref for ANSIGenericString<'a, S>
where <S as ToOwned>::Owned: Debug,

Source§

type Target = S

The resulting type after dereferencing.
Source§

fn deref(&self) -> &S

Dereferences the value.
Source§

impl<'a, I, S: 'a + ToOwned + ?Sized> From<I> for ANSIGenericString<'a, S>
where I: Into<Cow<'a, S>>, <S as ToOwned>::Owned: Debug,

Source§

fn from(input: I) -> ANSIGenericString<'a, S>

Converts to this type from the input type.
Source§

impl<'a, S: PartialEq + 'a + ToOwned + ?Sized> PartialEq for ANSIGenericString<'a, S>
where <S as ToOwned>::Owned: Debug,

Source§

fn eq(&self, other: &ANSIGenericString<'a, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, S: 'a + ToOwned + ?Sized> StructuralPartialEq for ANSIGenericString<'a, S>
where <S as ToOwned>::Owned: Debug,