Trait ParserError
trait ParserError<I: Stream>: Sized
The basic Parser trait for errors
It provides methods to create an error from some combinators,
and combine existing errors in combinators like alt.
Associated Types
type InnerGenerally,
SelfMostly used for
ErrMode
Required Methods
fn from_input(input: &I) -> SelfCreates an error from the input position
fn into_inner(self: Self) -> Result<<Self as >::Inner, Self>Unwrap the mode, returning the underlying error, if present
Provided Methods
fn assert(input: &I, _message: &'static str) -> Self where I: DebugProcess a parser assertion
fn incomplete(input: &I, _needed: Needed) -> SelfThere was not enough data to determine the appropriate action
More data needs to be buffered before retrying the parse.
This must only be set when the
Streamis [partial]crate::stream::StreamIsPartial, like with [Partial][crate::Partial]Convert this into an
BacktrackwithParser::complete_errfn append(self: Self, _input: &I, _token_start: &<I as Stream>::Checkpoint) -> SelfLike
ParserError::from_inputbut merges it with the existing error.This is useful when backtracking through a parse tree, accumulating error context on the way.
fn or(self: Self, other: Self) -> SelfCombines errors from two different parse branches.
For example, this would be used by [
alt][crate::combinator::alt] to report the error from each case.fn is_backtrack(self: &Self) -> boolIs backtracking and trying new parse branches allowed?
fn is_incomplete(self: &Self) -> boolIs more data
NeededThis must be the same as [
err.needed().is_some()][ParserError::needed]fn needed(self: &Self) -> Option<Needed>Extract the
Neededdata, if presentSelf::needed().is_some()must be the same as [err.is_incomplete()][ParserError::is_incomplete]
Implementors
impl<I: Stream + Clone> ParserError for InputError<I>impl<I: Stream> ParserError for ()impl<I: Stream, C> ParserError for ContextError<C>impl<I: Stream> ParserError for EmptyErrorimpl<I: Stream, E: ParserError<I>> ParserError for ErrMode<E>