pub enum DecodeError {
EmptyInput,
BufferTooSmall {
have: usize,
want: usize,
},
ZeroMarker {
at: usize,
},
ZeroBinary {
at: usize,
},
ChunkOverflow {
at: usize,
marker: u8,
len: usize,
},
}Expand description
Error types that can be returned from decoding.
Variants§
EmptyInput
The input is empty. A COBS stream is never shorter than one byte, since
the empty payload encodes as a single 0x01.
BufferTooSmall
The output buffer holds have bytes but the worst case decoding of the
input needs want, as computed by decode_buffer. Nothing was
written. Inputs of a single byte skip this check, they never produce
output.
ZeroMarker
The chunk marker at input offset at is zero, which no COBS stream
contains. Both decode and decode_nonzero report it. The latter
keeps this one check to stay memory safe.
ZeroBinary
A chunk payload contains a zero byte at input offset at, which the
encoder never produces. Only decode reports it. decode_nonzero
trusts the caller and decodes such input to garbage instead.
ChunkOverflow
The chunk marker at input offset at announces marker - 1 payload
bytes, which run past the len bytes of input. Truncated frames end up
here.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
fn clone(&self) -> DecodeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DecodeError
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
impl Eq for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()