#[non_exhaustive]pub enum ErrorKind {
UnexpectedEof {
needed: usize,
remaining: usize,
},
Incomplete {
needed: Option<usize>,
},
TrailingBytes {
remaining: usize,
},
TooWide {
width: usize,
},
Io(ErrorKind),
BadMagic {
expected: u128,
found: u128,
},
Convert {
message: String,
},
NotSeekable,
BufferFull {
cap: usize,
},
}Expand description
The cause of a BitError. #[non_exhaustive]: new variants may be added
without a major version bump, so match with a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnexpectedEof
Ran past the end of a finite input (a slice): needed bits were requested,
remaining were left. Definitive — distinct from Incomplete.
Incomplete
A streaming source (StreamBitReader) ran out mid-message: the caller
should read more bytes and retry. needed is a best-effort byte hint
(None when unknown). See BitError::is_incomplete.
TrailingBytes
decode_exact left whole bytes unconsumed after the message.
TooWide
A single field exceeded the 128-bit carrier width.
Io(ErrorKind)
std only.An I/O error while encoding to a std::io::Write sink (the std feature).
BadMagic
A magic constant read off the wire did not match. Both values are the
type-erased low-bit representations (Bits::into_bits).
Convert
A try_map conversion from the wire representation failed; message is the
converter’s Display output.
NotSeekable
A position directive (restore_position/seek) ran on a non-seekable
Source (a forward-only stream). Decode from a slice (BitReader) or a
seekable source instead.
BufferFull
A BufSource hit its retention cap before the message finished — the
framed message is larger than the configured bound (never unbounded).