[][src]Enum binread::error::Error

#[non_exhaustive]pub enum Error {
    BadMagic {
        pos: usize,
        found: Box<dyn Any>,
    },
    AssertFail {
        pos: usize,
        message: String,
    },
    Io(Error),
    Custom {
        pos: usize,
        err: Box<dyn Any>,
    },
    NoVariantMatch {
        pos: usize,
    },
    EnumErrors {
        pos: usize,
        variant_errors: Vec<(&'static str, Error)>,
    },
}

An error while parsing a BinRead type

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
BadMagic

The magic value did not match the provided one

Fields of BadMagic

pos: usizefound: Box<dyn Any>
AssertFail

The condition of an assertion without a custom type failed

Fields of AssertFail

pos: usizemessage: String
Io(Error)

An error that occured while reading from, or seeking within, the reader

Custom

A custom error, most often given from the second value passed into an assert

Fields of Custom

pos: usizeerr: Box<dyn Any>
NoVariantMatch

No variant in the enum was successful in parsing the data

Fields of NoVariantMatch

pos: usize
EnumErrors

Fields of EnumErrors

pos: usizevariant_errors: Vec<(&'static str, Error)>

Implementations

impl Error[src]

pub fn custom_err<T: Any>(&self) -> Option<&T>[src]

Gets a custom error of type T from the Error. Returns None if the error type is not custom or if the contained error is not of the desired type.

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

impl From<Error> for Error[src]

Auto Trait Implementations

impl !RefUnwindSafe for Error

impl !Send for Error

impl !Sync for Error

impl Unpin for Error

impl !UnwindSafe for Error

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.