Struct kparse::token_error::TokenizerError
source · pub struct TokenizerError<C, I> {
pub code: C,
pub span: I,
}
Expand description
Shorter error type for the tokenizer stage. Nom parsers fail often, so it’s good to keep this minimal.
Fields§
§code: C
Error code
span: I
Error span
Implementations§
source§impl<C, I> TokenizerError<C, I>where
C: Code,
I: Clone,
impl<C, I> TokenizerError<C, I>where C: Code, I: Clone,
sourcepub fn append_err(&mut self, other: TokenizerError<C, I>)
pub fn append_err(&mut self, other: TokenizerError<C, I>)
Replaces the information with the other error. Unless the other contains only the generic NOM_ERROR.
Trait Implementations§
source§impl<C, I> Debug for TokenizerError<C, I>where
C: Code,
I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
impl<C, I> Debug for TokenizerError<C, I>where C: Code, I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
source§impl<C, I> Display for TokenizerError<C, I>where
C: Code,
I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
impl<C, I> Display for TokenizerError<C, I>where C: Code, I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
source§impl<C, I> ErrOrNomErr for TokenizerError<C, I>where
C: Code,
I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
impl<C, I> ErrOrNomErr for TokenizerError<C, I>where C: Code, I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
§type WrappedError = TokenizerError<C, I>
type WrappedError = TokenizerError<C, I>
The base error type.
source§fn wrap(self) -> Err<Self::WrappedError>
fn wrap(self) -> Err<Self::WrappedError>
Converts self to a
nom::Err
wrapped error.source§impl<C, I> Error for TokenizerError<C, I>where
C: Code,
I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
impl<C, I> Error for TokenizerError<C, I>where C: Code, I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl<C, I> From<TokenizerError<C, I>> for ParserError<C, I>where
C: Code,
I: Clone,
impl<C, I> From<TokenizerError<C, I>> for ParserError<C, I>where C: Code, I: Clone,
source§fn from(value: TokenizerError<C, I>) -> Self
fn from(value: TokenizerError<C, I>) -> Self
Converts to this type from the input type.
source§impl<C, I> KParseError<C, I> for TokenizerError<C, I>where
C: Code,
I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
impl<C, I> KParseError<C, I> for TokenizerError<C, I>where C: Code, I: Clone + Debug + SpanFragment + InputTake + InputLength + InputIter,
§type WrappedError = TokenizerError<C, I>
type WrappedError = TokenizerError<C, I>
The base error type.
source§fn 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
.source§fn 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
.source§fn 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
.source§fn 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
.source§impl<C, I> ParseError<I> for TokenizerError<C, I>where
C: Code,
I: Clone + Debug + InputTake + InputLength + InputIter,
impl<C, I> ParseError<I> for TokenizerError<C, I>where C: Code, I: Clone + Debug + InputTake + InputLength + InputIter,
source§fn 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
source§fn append(_input: I, _kind: ErrorKind, other: Self) -> Self
fn append(_input: I, _kind: ErrorKind, other: Self) -> Self
Combines an existing error with a new one created from the input
position and an ErrorKind. This is useful when backtracking
through a parse tree, accumulating error context on the way
Auto Trait Implementations§
impl<C, I> RefUnwindSafe for TokenizerError<C, I>where C: RefUnwindSafe, I: RefUnwindSafe,
impl<C, I> Send for TokenizerError<C, I>where C: Send, I: Send,
impl<C, I> Sync for TokenizerError<C, I>where C: Sync, I: Sync,
impl<C, I> Unpin for TokenizerError<C, I>where C: Unpin, I: Unpin,
impl<C, I> UnwindSafe for TokenizerError<C, I>where C: UnwindSafe, I: UnwindSafe,
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