Enum Err

pub enum Err<Failure, Error = Failure>

The Err enum indicates the parser was not successful

It has three cases:

Distinguishing Failure this from Error is only relevant inside the parser's code. For external consumers, both mean that parsing failed.

See also: Finish.

Variants

Incomplete(Needed)

There was not enough data

Error(Error)

The parser had an error (recoverable)

Failure(Failure)

The parser had an unrecoverable error: we got to the right branch and we know other branches won't work, so backtrack as fast as possible

Implementations

impl Err<(&[u8], ErrorKind)>

fn to_owned(self) -> Err<(Vec<u8>, ErrorKind)>

Obtaining ownership

impl Err<(&str, ErrorKind)>

fn to_owned(self) -> Err<(String, ErrorKind)>

Obtaining ownership

impl Err<Error<&[u8]>>

fn to_owned(self) -> Err<Error<Vec<u8>>>

Obtaining ownership

impl Err<Error<&str>>

fn to_owned(self) -> Err<Error<String>>

Obtaining ownership

impl<E> Err<E>

fn is_incomplete(&self) -> bool

Tests if the result is Incomplete

fn map<E2, F>(self, f: F) -> Err<E2>
where
    F: FnOnce(E) -> E2,

Applies the given function to the inner error

fn convert<F>(e: Err<F>) -> Self
where
    E: From<F>,

Automatically converts between errors if the underlying type supports it

impl<T> Err<(T, ErrorKind)>

fn map_input<U, F>(self, f: F) -> Err<(U, ErrorKind)>
where
    F: FnOnce(T) -> U,

Maps Err<(T, ErrorKind)> to Err<(U, ErrorKind)> with the given F: T -> U

impl<T> Err<Error<T>>

fn map_input<U, F>(self, f: F) -> Err<Error<U>>
where
    F: FnOnce(T) -> U,

Maps Err<error::Error<T>> to Err<error::Error<U>> with the given F: T -> U

Trait Implementations

impl<E> Display for Err<E> where E: Debug,

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<E> Error for Err<E> where E: Debug,

fn source(&self) -> Option<&dyn Error + 'static>

impl<E: Eq> Eq for Err<E>

impl<Failure: Clone, Error: Clone> Clone for Err<Failure, Error>

fn clone(&self) -> Self

impl<Failure: Debug, Error: Debug> Debug for Err<Failure, Error>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<Failure: PartialEq, Error: PartialEq> PartialEq for Err<Failure, Error>

fn eq(&self, other: &Self) -> bool

impl<Failure: PartialEq, Error: PartialEq> StructuralPartialEq for Err<Failure, Error>

Auto Trait Implementations

impl<Failure, Error> Freeze for Err<Failure, Error> where Error: Freeze, Failure: Freeze,

impl<Failure, Error> RefUnwindSafe for Err<Failure, Error> where Error: RefUnwindSafe, Failure: RefUnwindSafe,

impl<Failure, Error> Send for Err<Failure, Error> where Error: Send, Failure: Send,

impl<Failure, Error> Sync for Err<Failure, Error> where Error: Sync, Failure: Sync,

impl<Failure, Error> Unpin for Err<Failure, Error> where Error: Unpin, Failure: Unpin,

impl<Failure, Error> UnsafeUnpin for Err<Failure, Error> where Error: UnsafeUnpin, Failure: UnsafeUnpin,

impl<Failure, Error> UnwindSafe for Err<Failure, Error> where Error: UnwindSafe, Failure: UnwindSafe,

Blanket Implementations

impl<T> Any for Err<Failure, Error> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Err<Failure, Error> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Err<Failure, Error> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Err<Failure, Error> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Err<Failure, Error>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Err<Failure, Error> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for Err<Failure, Error> where T: Display + ?Sized,

fn to_string(&self) -> String

impl<T, U> Into<U> for Err<Failure, Error> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Err<Failure, Error> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Err<Failure, Error> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>