pub enum CodecError {
Empty,
Version {
expected: u8,
actual: u8,
},
Encode(Error),
Decode(Error),
}Expand description
Failure modes of the version-prefixed postcard codec.
Encode and Decode are kept distinct so a caller can tell which
direction failed; both carry the underlying postcard::Error as the
error source rather than via a From conversion, so a stray ? on a
postcard result never silently becomes a CodecError.
Variants§
Empty
The payload had no leading version byte (it was empty).
Version
The leading version byte did not match the version the reader expected. A stale reader hits this instead of misdecoding old bytes against a new struct layout.
Encode(Error)
postcard failed to serialize the value.
Decode(Error)
postcard failed to deserialize the framed body.
Trait Implementations§
Source§impl Debug for CodecError
impl Debug for CodecError
Source§impl Display for CodecError
impl Display for CodecError
Source§impl Error for CodecError
impl Error for CodecError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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()
Auto Trait Implementations§
impl Freeze for CodecError
impl RefUnwindSafe for CodecError
impl Send for CodecError
impl Sync for CodecError
impl Unpin for CodecError
impl UnsafeUnpin for CodecError
impl UnwindSafe for CodecError
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