Enum sli::Error[][src]

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

An error while parsing a BinRead type

Variants (Non-exhaustive)

This enum is marked as 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

Show fields

Fields of BadMagic

pos: usizefound: Box<dyn Any + 'static, Global>
AssertFail

The condition of an assertion without a custom type failed

Show fields

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

Show fields

Fields of Custom

pos: usizeerr: Box<dyn Any + 'static, Global>
NoVariantMatch

No variant in the enum was successful in parsing the data

Show fields

Fields of NoVariantMatch

pos: usize
EnumErrors
Show fields

Fields of EnumErrors

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

Implementations

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

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.