pub struct Error<I> {
pub input: I,
pub code: ErrorKind,
}
Expand description
default error type, only contains the error’s location and code
Fields§
§input: I
position of the error in the input data
code: ErrorKind
nom error code
Implementations§
Trait Implementations§
Source§impl<I> ContextError<I> for Error<I>
impl<I> ContextError<I> for Error<I>
Source§fn add_context(_input: I, _ctx: &'static str, other: Self) -> Self
fn add_context(_input: I, _ctx: &'static str, other: Self) -> Self
Creates a new error from an input position, a static string and an existing error.
This is used mainly in the context combinator, to add user friendly information
to errors when backtracking through a parse tree
Source§impl<I> Display for Error<I>where
I: Display,
impl<I> Display for Error<I>where
I: Display,
The Display implementation allows the std::error::Error implementation
Source§impl<I> Error for Error<I>
impl<I> Error for Error<I>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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<I, E> FromExternalError<I, E> for Error<I>
impl<I, E> FromExternalError<I, E> for Error<I>
Source§fn from_external_error(input: I, kind: ErrorKind, _e: E) -> Error<I>
fn from_external_error(input: I, kind: ErrorKind, _e: E) -> Error<I>
Create a new error from an input position and an external error
Source§impl<I> ParseError<I> for Error<I>
impl<I> ParseError<I> for Error<I>
Source§fn from_error_kind(input: I, kind: ErrorKind) -> Error<I>
fn from_error_kind(input: I, kind: ErrorKind) -> Error<I>
Creates an error from the input position and an ErrorKind
Source§fn append(_: I, _: ErrorKind, other: Error<I>) -> Error<I>
fn append(_: I, _: ErrorKind, other: Error<I>) -> Error<I>
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
impl<I> Eq for Error<I>where
I: Eq,
impl<I> StructuralPartialEq for Error<I>
Auto Trait Implementations§
impl<I> Freeze for Error<I>where
I: Freeze,
impl<I> RefUnwindSafe for Error<I>where
I: RefUnwindSafe,
impl<I> Send for Error<I>where
I: Send,
impl<I> Sync for Error<I>where
I: Sync,
impl<I> Unpin for Error<I>where
I: Unpin,
impl<I> UnwindSafe for Error<I>where
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more