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
Too many bits requested to fit in the requested data type
Fields
NotEnoughData
Not enough data in the buffer to read all requested bits
Fields
IndexOutOfBounds
The requested position is outside the bounds of the stream or buffer
UnmatchedDiscriminant
Unmatched discriminant found while trying to read an enum
Fields
Utf8Error(Utf8Error, usize)
The read slice of bytes are not valid utf8
StringToLong
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
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
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.
Auto Trait Implementations§
impl Freeze for BitError
impl RefUnwindSafe for BitError
impl Send for BitError
impl Sync for BitError
impl Unpin for BitError
impl UnwindSafe for BitError
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more