pub enum DecodeError<SourceError, DestinationError> {
Source(SourceError),
Destination(DestinationError),
UnexpectedSourceEof,
EmptyFrame,
InvalidFrame(DecodeProgress),
}Expand description
A failure to decode a frame.
Generic parameters preserve the source and destination error types.
Match their variants to inspect them: the current core::error::Error
implementation does not forward source().
Errors do not roll back partial output.
Only InvalidFrame carries progress information.
Implementations such as Clone, Copy, serialization, and compact formatting
depend on the corresponding traits being implemented by both generic error parameters.
Error formatting is diagnostic output, not a stable serialization format.
Variants§
Source(SourceError)
Reading the source failed.
Never returned by the sync module, which reads from
memory.
Destination(DestinationError)
The destination cannot hold the next decoded byte.
sync::decode_to_slice reports
SeekableError::OutOfBounds here. The destination may be partially
overwritten.
UnexpectedSourceEof
The input ended before the current COBS block was complete.
EmptyFrame
One-shot decoding reached EOF without starting an encoded frame.
Empty input and zero padding alone produce this error. A valid
encoding of an empty payload, such as [1], does not.
InvalidFrame(DecodeProgress)
A zero delimiter arrived before the current COBS block had enough data.
Progress includes the delimiter and has frame_len: None. Partial
output already written to the destination is not removed.
The next frame starts at source[progress.consumed as usize..].
Trait Implementations§
Source§impl<SourceError: Clone, DestinationError: Clone> Clone for DecodeError<SourceError, DestinationError>
impl<SourceError: Clone, DestinationError: Clone> Clone for DecodeError<SourceError, DestinationError>
impl<SourceError: Copy, DestinationError: Copy> Copy for DecodeError<SourceError, DestinationError>
Source§impl<SourceError: Debug, DestinationError: Debug> Debug for DecodeError<SourceError, DestinationError>
impl<SourceError: Debug, DestinationError: Debug> Debug for DecodeError<SourceError, DestinationError>
Source§impl<'de, SourceError, DestinationError> Deserialize<'de> for DecodeError<SourceError, DestinationError>where
SourceError: Deserialize<'de>,
DestinationError: Deserialize<'de>,
impl<'de, SourceError, DestinationError> Deserialize<'de> for DecodeError<SourceError, DestinationError>where
SourceError: Deserialize<'de>,
DestinationError: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<S, D> Display for DecodeError<S, D>
impl<S, D> Display for DecodeError<S, D>
impl<SourceError: Eq, DestinationError: Eq> Eq for DecodeError<SourceError, DestinationError>
Source§impl<S: Error, D: Error> Error for DecodeError<S, D>
impl<S: Error, D: Error> Error for DecodeError<S, D>
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()
Source§impl<S, D> Format for DecodeError<S, D>
Available on crate feature defmt only.
impl<S, D> Format for DecodeError<S, D>
defmt only.