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

#[non_exhaustive]pub enum Error {
    BadMagic {
        pos: usize,
        found: Box<dyn Any + Sync + Send>,
    AssertFail {
        pos: usize,
        message: String,
    Custom {
        pos: usize,
        err: Box<dyn Any + Sync + Send>,
    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.

The magic value did not match the provided one

Fields of BadMagic

pos: usizefound: Box<dyn Any + Sync + Send>

The condition of an assertion without a custom type failed

Fields of AssertFail

pos: usizemessage: String

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


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

Fields of Custom

pos: usizeerr: Box<dyn Any + Sync + Send>

No variant in the enum was successful in parsing the data

Fields of NoVariantMatch

pos: usize

Fields of EnumErrors

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


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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.