Trait winnow::error::ParserError
source · pub trait ParserError<I>: Sized {
// Required methods
fn from_error_kind(input: &I, kind: ErrorKind) -> Self;
fn append(self, input: &I, kind: ErrorKind) -> Self;
// Provided methods
fn assert(input: &I, _message: &'static str) -> Self
where I: Debug { ... }
fn or(self, other: Self) -> Self { ... }
}
Expand description
The basic Parser
trait for errors
It provides methods to create an error from some combinators,
and combine existing errors in combinators like alt
.
Required Methods§
sourcefn from_error_kind(input: &I, kind: ErrorKind) -> Self
fn from_error_kind(input: &I, kind: ErrorKind) -> Self
Creates an error from the input position and an ErrorKind
sourcefn append(self, input: &I, kind: ErrorKind) -> Self
fn append(self, input: &I, kind: ErrorKind) -> Self
Like ParserError::from_error_kind
but merges it with the existing error.
This is useful when backtracking through a parse tree, accumulating error context on the way.
Provided Methods§
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl<I> ParserError<I> for ()
impl<I> ParserError<I> for ()
Implementors§
impl<I> ParserError<I> for ErrorKind
impl<I, C> ParserError<I> for TreeError<I, C>where
I: Clone,
Available on crate feature
std
only.impl<I, C> ParserError<I> for ContextError<C>
impl<I, E: ParserError<I>> ParserError<I> for ErrMode<E>
impl<I: Clone> ParserError<I> for InputError<I>
impl<I: Clone, C> ParserError<I> for VerboseError<I, C>
Available on crate feature
std
only.