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(Utf8Error, usize),
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
Too many bits requested to fit in the requested data type
NotEnoughData
Fields
Not enough data in the buffer to read all requested bits
IndexOutOfBounds
The requested position is outside the bounds of the stream or buffer
UnmatchedDiscriminant
Fields
Unmatched discriminant found while trying to read an enum
Utf8Error(Utf8Error, usize)
The read slice of bytes are not valid utf8
StringToLong
Fields
The string that was requested to be written does not fit in the specified fixed length
Trait Implementations§
source§impl Error for BitError
impl Error for BitError
source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§impl From<FromUtf8Error> for BitError
impl From<FromUtf8Error> for BitError
source§fn from(err: FromUtf8Error) -> Self
fn from(err: FromUtf8Error) -> Self
Converts to this type from the input type.