[][src]Struct yew_ansi::CharCursor

pub struct CharCursor<'a> { /* fields omitted */ }

Cursor for characters in a string slice.

Implementations

impl<'a> CharCursor<'a>[src]

pub fn new(s: &'a str) -> Self[src]

Create a cursor for the given slice. The cursor starts at the start of the slice.

pub fn position(&self) -> usize[src]

Get the cursor's position in the slice. This will always point to a valid char boundary.

pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&'a I::Output>[src]

Index the contained string slice. The index isn't bound by the cursor's position, only by the underlying slice.

pub fn remainder(&self) -> &'a str[src]

Get a string slice containing all the characters following the current position.

pub fn peek_char(&self, expected: char) -> bool[src]

Check if the next character matches the expected one. This doesn't advance the cursor's position.

pub fn read(&mut self) -> Option<char>[src]

Read the next character and advance the cursor.

pub fn read_char(&mut self, expected: char) -> Option<char>[src]

Read the next character and advance the cursor only if it matches the expected one. Returns None if the character didn't match.

pub fn read_while(&mut self, f: impl FnMut(char) -> bool)[src]

Advance the cursor while the given function returns true. The cursor won't advance if the function returns false.

Trait Implementations

impl<'a> Clone for CharCursor<'a>[src]

impl<'a> Debug for CharCursor<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for CharCursor<'a>

impl<'a> Send for CharCursor<'a>

impl<'a> Sync for CharCursor<'a>

impl<'a> Unpin for CharCursor<'a>

impl<'a> UnwindSafe for CharCursor<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.