pub struct ParseState<'i> { /* private fields */ }Expand description
Per-parse shared state.
Tracks the furthest encountered error, allowing combinators like Parser::optional to return
Ok while still reporting the furthest seen error for better user-facing error messages.
Implementations§
Source§impl<'i> ParseState<'i>
impl<'i> ParseState<'i>
Sourcepub fn error(&mut self, error: ParseError, remaining: &'i [u8]) -> ErrToken
pub fn error(&mut self, error: ParseError, remaining: &'i [u8]) -> ErrToken
Record an error.
The error will be discarded if a further error is already stored.
Returns an ErrToken which can be used to return Err from Parser::parse_ctx.
Sourcepub fn into_input_error(self, input: &str) -> InputError
pub fn into_input_error(self, input: &str) -> InputError
Build an InputError from the furthest error seen.
Trait Implementations§
Source§impl<'i> Default for ParseState<'i>
impl<'i> Default for ParseState<'i>
Source§fn default() -> ParseState<'i>
fn default() -> ParseState<'i>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'i> Freeze for ParseState<'i>
impl<'i> RefUnwindSafe for ParseState<'i>
impl<'i> Send for ParseState<'i>
impl<'i> Sync for ParseState<'i>
impl<'i> Unpin for ParseState<'i>
impl<'i> UnwindSafe for ParseState<'i>
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