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,

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

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

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

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

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

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

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