Enum packtool::Error[][src]

pub enum Error {
    InvalidSize {
        ty: &'static str,
        received: usize,
        expected: usize,
    },
    Assumption {
        ty: &'static str,
        assumption: &'static str,
        message: String,
    },
    InvalidDiscriminant {
        ty: &'static str,
        options: &'static str,
        found: Box<dyn Debug + Send + Sync>,
    },
    InvalidField {
        ty: &'static str,
        field: &'static str,
    },
    InvalidTuple {
        ty: &'static str,
        index: usize,
    },
    Message(Cow<'static, str>),
    Custom(Box<dyn Error + Send + Sync>),
    Context {
        ty: &'static str,
        error: Box<Self>,
        cause: Box<Self>,
    },
}
Expand description

error associated to unpacking or creating [View] of [Packed] types.

Variants

InvalidSize

error that is returned if an invalid size is detected

this will happen when calling [View::try_from_slice] for example.

Show fields

Fields of InvalidSize

ty: &'static str

the stringified type associated to this error

received: usize

the size of the slice that does not match the expected size

expected: usize

the expected size

Assumption

error that is created when an assumption is false

this is used by ensure macro

Show fields

Fields of Assumption

ty: &'static str

the stringified type associated to this error

assumption: &'static str

the stringified assumption

message: String

a custom message associated to the assumption

InvalidDiscriminant

error when trying to check an Enumeration against a slice

Show fields

Fields of InvalidDiscriminant

ty: &'static str

the stringified type associated to this error

options: &'static str

the available values (if any)

found: Box<dyn Debug + Send + Sync>

the actually found value

InvalidField
Show fields

Fields of InvalidField

ty: &'static str

the stringified type associated to this error

field: &'static str
InvalidTuple
Show fields

Fields of InvalidTuple

ty: &'static str

the stringified type associated to this error

index: usize
Message(Cow<'static, str>)
Custom(Box<dyn Error + Send + Sync>)
Context
Show fields

Fields of Context

ty: &'static str

the stringified type associated to this error

error: Box<Self>cause: Box<Self>

the root cause of the error

recursively call the underlying error to find more granulated details of a given error

Implementations

convenient function to create an Error::InvalidSize with the type_name of T being captured

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.

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.