Skip to main content

Error

Type Alias Error 

Source
pub type Error = Error;

Aliased Type§

pub enum Error {
    BadMagic {
        pos: u64,
        found: Box<dyn Debug + Sync + Send>,
    },
    AssertFail {
        pos: u64,
        message: String,
    },
    Io(Error),
    Custom {
        pos: u64,
        err: Box<dyn CustomError>,
    },
    NoVariantMatch {
        pos: u64,
    },
    EnumErrors {
        pos: u64,
        variant_errors: Vec<(&'static str, Error)>,
    },
    Backtrace(Backtrace),
}

Variants§

§

BadMagic

An expected magic number was not found.

Fields

§pos: u64

The byte position of the unexpected magic in the reader.

§found: Box<dyn Debug + Sync + Send>

The value which was actually read.

§

AssertFail

An assertion failed.

This variant is used for assert directives which use a string literal instead of an error object. Assertions that use error objects are represented by the Custom variant.

Fields

§pos: u64

The byte position of the start of the field or object that raised an error.

§message: String

The failure message.

§

Io(Error)

An error occurred in the underlying reader while reading or seeking to data.

§

Custom

A user-generated error.

This variant is used for assert directives which use an error object instead of a string literal. Assertions that use string literals are represented by the AssertFail variant.

Fields

§pos: u64

The byte position of the start of the field or object that raised an error.

§err: Box<dyn CustomError>

The original error.

§

NoVariantMatch

None of the variants of an enum could successfully be parsed from the data in the reader.

This variant is used when the return_unexpected_error directive is set on an enum.

Fields

§pos: u64

The byte position of the unparsable data in the reader.

§

EnumErrors

None of the variants of an enum could successfully be parsed from the data in the reader.

This variant is used when the return_all_errors directive is set on an enum (which is the default).

Fields

§pos: u64

The byte position of the unparsable data in the reader.

§variant_errors: Vec<(&'static str, Error)>

The original errors which occurred when trying to parse each variant.

The first field of the tuple is the name of the variant, and the second field is the error that occurred when parsing that variant.

§

Backtrace(Backtrace)

An error with additional frames of context used to construct a backtrace