Trait kparse::KParseError
source · pub trait KParseError<C, I> {
type WrappedError: Debug;
// Required methods
fn from(code: C, span: I) -> Self;
fn with_code(self, code: C) -> Self;
fn code(&self) -> Option<C>;
fn span(&self) -> Option<I>;
fn err(&self) -> Option<&Self::WrappedError>;
fn parts(&self) -> Option<(C, I, &Self::WrappedError)>;
}
Expand description
This trait catches the essentials for an error type within this library.
It is implemented for E
, nom::Err<E>
and Result<(I,O), nom::Err<E>>
.
Required Associated Types§
sourcetype WrappedError: Debug
type WrappedError: Debug
The base error type.
Required Methods§
sourcefn code(&self) -> Option<C>
fn code(&self) -> Option<C>
Returns the error code if self is Result::Err
and it’s not nom::Err::Incomplete
.
sourcefn span(&self) -> Option<I>
fn span(&self) -> Option<I>
Returns the error span if self is Result::Err
and it’s not nom::Err::Incomplete
.
sourcefn err(&self) -> Option<&Self::WrappedError>
fn err(&self) -> Option<&Self::WrappedError>
Returns the error if self is Result::Err
and it’s not nom::Err::Incomplete
.
sourcefn parts(&self) -> Option<(C, I, &Self::WrappedError)>
fn parts(&self) -> Option<(C, I, &Self::WrappedError)>
Returns all the parts if self is Result::Err
and it’s not nom::Err::Incomplete
.
Object Safety§
This trait is not object safe.