Struct VerboseError
pub struct VerboseError<I> {
pub errors: Vec<(I, VerboseErrorKind)>,
}
Expand description
This error type accumulates errors and their position when backtracking
through a parse tree. With some post processing (cf examples/json.rs
),
it can be used to display user friendly error messages
Fields§
§errors: Vec<(I, VerboseErrorKind)>
List of errors accumulated by VerboseError
, containing the affected
part of input data, and some context
Trait Implementations§
§impl<I> Clone for VerboseError<I>where
I: Clone,
impl<I> Clone for VerboseError<I>where
I: Clone,
§fn clone(&self) -> VerboseError<I>
fn clone(&self) -> VerboseError<I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl<I> ContextError<I> for VerboseError<I>
impl<I> ContextError<I> for VerboseError<I>
§fn add_context(
input: I,
ctx: &'static str,
other: VerboseError<I>,
) -> VerboseError<I>
fn add_context( input: I, ctx: &'static str, other: VerboseError<I>, ) -> VerboseError<I>
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
§impl<I> Debug for VerboseError<I>where
I: Debug,
impl<I> Debug for VerboseError<I>where
I: Debug,
§impl<I> Display for VerboseError<I>where
I: Display,
impl<I> Display for VerboseError<I>where
I: Display,
§impl<I> Error for VerboseError<I>
impl<I> Error for VerboseError<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()
§impl<I> ErrorConvert<VerboseError<(I, usize)>> for VerboseError<I>
impl<I> ErrorConvert<VerboseError<(I, usize)>> for VerboseError<I>
§fn convert(self) -> VerboseError<(I, usize)>
fn convert(self) -> VerboseError<(I, usize)>
Transform to another error type
§impl<I> ErrorConvert<VerboseError<I>> for VerboseError<(I, usize)>
impl<I> ErrorConvert<VerboseError<I>> for VerboseError<(I, usize)>
§fn convert(self) -> VerboseError<I>
fn convert(self) -> VerboseError<I>
Transform to another error type
§impl<I, E> FromExternalError<I, E> for VerboseError<I>
impl<I, E> FromExternalError<I, E> for VerboseError<I>
§fn from_external_error(input: I, kind: ErrorKind, _e: E) -> VerboseError<I>
fn from_external_error(input: I, kind: ErrorKind, _e: E) -> VerboseError<I>
Create a new error from an input position and an external error
§impl<I> ParseError<I> for VerboseError<I>
impl<I> ParseError<I> for VerboseError<I>
§fn from_error_kind(input: I, kind: ErrorKind) -> VerboseError<I>
fn from_error_kind(input: I, kind: ErrorKind) -> VerboseError<I>
Creates an error from the input position and an ErrorKind
§fn append(input: I, kind: ErrorKind, other: VerboseError<I>) -> VerboseError<I>
fn append(input: I, kind: ErrorKind, other: VerboseError<I>) -> VerboseError<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
§fn from_char(input: I, c: char) -> VerboseError<I>
fn from_char(input: I, c: char) -> VerboseError<I>
Creates an error from an input position and an expected character
§impl<I> PartialEq for VerboseError<I>where
I: PartialEq,
impl<I> PartialEq for VerboseError<I>where
I: PartialEq,
impl<I> StructuralPartialEq for VerboseError<I>
Auto Trait Implementations§
impl<I> Freeze for VerboseError<I>
impl<I> RefUnwindSafe for VerboseError<I>where
I: RefUnwindSafe,
impl<I> Send for VerboseError<I>where
I: Send,
impl<I> Sync for VerboseError<I>where
I: Sync,
impl<I> Unpin for VerboseError<I>where
I: Unpin,
impl<I> UnwindSafe for VerboseError<I>where
I: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<Error> ErrorExt for Error
impl<Error> ErrorExt for Error
§fn context<M>(self, context: M) -> OpaqueError
fn context<M>(self, context: M) -> OpaqueError
Wrap the error in a context. Read more
§fn with_context<C, F>(self, context: F) -> OpaqueError
fn with_context<C, F>(self, context: F) -> OpaqueError
Lazily wrap the error with a context. Read more
§fn backtrace(self) -> OpaqueError
fn backtrace(self) -> OpaqueError
§fn into_opaque(self) -> OpaqueError
fn into_opaque(self) -> OpaqueError
Convert the error into an
OpaqueError
. Read more§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Create a new
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more§impl<T, U> RamaTryInto<U> for Twhere
U: RamaTryFrom<T>,
impl<T, U> RamaTryInto<U> for Twhere
U: RamaTryFrom<T>,
type Error = <U as RamaTryFrom<T>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U> RamaTryInto<U> for Twhere
U: RamaTryFrom<T>,
impl<T, U> RamaTryInto<U> for Twhere
U: RamaTryFrom<T>,
type Error = <U as RamaTryFrom<T>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T> ToSmolStr for T
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.