pub struct ParseState<'a, I> { /* private fields */ }
Expand description
A struct representing the current parsing state.
Implementations§
Source§impl<'a, I> ParseState<'a, I>
impl<'a, I> ParseState<'a, I>
Sourcepub fn new(input: &'a [I], offset: usize) -> Self
pub fn new(input: &'a [I], offset: usize) -> Self
Creates a new parsing state with the given input and offset.
Sourcepub fn last_offset(&self) -> Option<usize>
pub fn last_offset(&self) -> Option<usize>
Returns the offset of the previous position, or None if at the beginning.
Sourcepub fn current_offset(&self) -> usize
pub fn current_offset(&self) -> usize
Returns the current offset.
Sourcepub fn advance_by(&self, num_chars: usize) -> ParseState<'a, I>
pub fn advance_by(&self, num_chars: usize) -> ParseState<'a, I>
Creates a new parse state with an offset increased by the specified number of characters.
Sourcepub fn slice_with_len(&self, n: usize) -> &'a [I]
pub fn slice_with_len(&self, n: usize) -> &'a [I]
Returns a slice of the input with a specified length starting from the current offset.
Trait Implementations§
Source§impl<'a, I: Clone> Clone for ParseState<'a, I>
impl<'a, I: Clone> Clone for ParseState<'a, I>
Source§fn clone(&self) -> ParseState<'a, I>
fn clone(&self) -> ParseState<'a, I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a, I> Freeze for ParseState<'a, I>
impl<'a, I> RefUnwindSafe for ParseState<'a, I>where
I: RefUnwindSafe,
impl<'a, I> Send for ParseState<'a, I>where
I: Sync,
impl<'a, I> Sync for ParseState<'a, I>where
I: Sync,
impl<'a, I> Unpin for ParseState<'a, I>
impl<'a, I> UnwindSafe for ParseState<'a, I>where
I: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more