[−][src]Struct yew_ansi::CharCursor
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]
fn clone(&self) -> CharCursor<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,