Enum bitbuffer::BitError

source ·
pub enum BitError {
    TooManyBits {
        requested: usize,
        max: usize,
    },
    NotEnoughData {
        requested: usize,
        bits_left: usize,
    },
    IndexOutOfBounds {
        pos: usize,
        size: usize,
    },
    UnmatchedDiscriminant {
        discriminant: usize,
        enum_name: String,
    },
    Utf8Error(Utf8Errorusize),
    StringToLong {
        string_length: usize,
        requested_length: usize,
    },
}
Expand description

Errors that can be returned when trying to read from or write to a buffer

Variants§

§

TooManyBits

Fields

§requested: usize

The number of bits requested to read

§max: usize

The number of bits that fit in the requested data type

Too many bits requested to fit in the requested data type

§

NotEnoughData

Fields

§requested: usize

The number of bits requested to read

§bits_left: usize

the number of bits left in the buffer

Not enough data in the buffer to read all requested bits

§

IndexOutOfBounds

Fields

§pos: usize

The requested position

§size: usize

the number of bits in the buffer

The requested position is outside the bounds of the stream or buffer

§

UnmatchedDiscriminant

Fields

§discriminant: usize

The read discriminant

§enum_name: String

The name of the enum that is trying to be read

Unmatched discriminant found while trying to read an enum

§

Utf8Error(Utf8Errorusize)

The read slice of bytes are not valid utf8

§

StringToLong

Fields

§string_length: usize

Length of the string that was requested to be written

§requested_length: usize

The requested fixed size to encode the string into

The string that was requested to be written does not fit in the specified fixed length

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. 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
The lower-level source of this error, if any. Read more
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
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.