pub enum Error<P, E = u32> {
Code(ErrorKind<E>),
Node(ErrorKind<E>, Box<Err<P, E>>),
Position(ErrorKind<E>, P),
NodePosition(ErrorKind<E>, P, Box<Err<P, E>>),
}
Expand description
Contains the error that a parser can return
It can represent a linked list of errors, indicating the path taken in the parsing tree, with corresponding position in the input data. It depends on P, the input position (for a &u8 parser, it would be a &u8), and E, the custom error type (by default, u32)
Variants§
Code(ErrorKind<E>)
An error code, represented by an ErrorKind, which can contain a custom error code represented by E
Node(ErrorKind<E>, Box<Err<P, E>>)
An error code, and the next error
Position(ErrorKind<E>, P)
An error code, and the input position
NodePosition(ErrorKind<E>, P, Box<Err<P, E>>)
An error code, the input position and the next error
Trait Implementations§
Source§impl<P, E> Error for Err<P, E>
impl<P, E> Error for Err<P, E>
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
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
impl<P, E> Eq for Err<P, E>
impl<P, E> StructuralPartialEq for Err<P, E>
Auto Trait Implementations§
impl<P, E> Freeze for Err<P, E>
impl<P, E> RefUnwindSafe for Err<P, E>where
P: RefUnwindSafe,
E: RefUnwindSafe,
impl<P, E> Send for Err<P, E>
impl<P, E> Sync for Err<P, E>
impl<P, E> Unpin for Err<P, E>
impl<P, E> UnwindSafe for Err<P, E>where
P: UnwindSafe,
E: 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