Struct AnsiCodeIterator

pub struct AnsiCodeIterator<'a> { /* private fields */ }

An iterator over ansi codes in a string.

This type can be used to scan over ansi codes in a string. It yields tuples in the form (s, is_ansi) where s is a slice of the original string and is_ansi indicates if the slice contains ansi codes or string values.

Implementations

impl<'a> AnsiCodeIterator<'a>

fn new(s: &'a str) -> AnsiCodeIterator<'a>

Creates a new ansi code iterator.

fn current_slice(&self) -> &str

Returns the string slice up to the current match.

fn rest_slice(&self) -> &str

Returns the string slice from the current match to the end.

Trait Implementations

impl FusedIterator for AnsiCodeIterator<'_>

impl<'a> Iterator for AnsiCodeIterator<'a>

type Item = (&'a str, bool);
fn next(&mut self) -> Option<(&'a str, bool)>

Auto Trait Implementations

impl<'a> Freeze for AnsiCodeIterator<'a>

impl<'a> RefUnwindSafe for AnsiCodeIterator<'a>

impl<'a> Send for AnsiCodeIterator<'a>

impl<'a> Sync for AnsiCodeIterator<'a>

impl<'a> Unpin for AnsiCodeIterator<'a>

impl<'a> UnsafeUnpin for AnsiCodeIterator<'a>

impl<'a> UnwindSafe for AnsiCodeIterator<'a>

Blanket Implementations

impl<I> IntoIterator for AnsiCodeIterator<'a> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for AnsiCodeIterator<'a> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for AnsiCodeIterator<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for AnsiCodeIterator<'a> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for AnsiCodeIterator<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for AnsiCodeIterator<'a> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for AnsiCodeIterator<'a> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for AnsiCodeIterator<'a> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>