pub trait Codec: Sized {
type Error: Debug;
}Expand description
A serialization family.
Implemented once per family (not per message type) so that the family’s error
type is declared in one place and CodecFor<T> can stay a blanket impl over
whatever bound the underlying library needs. Codecs are zero-sized markers;
they are named as type parameters and never instantiated.
Required Associated Types§
Sourcetype Error: Debug
type Error: Debug
Error returned by both CodecFor::encode and CodecFor::decode.
Typically the backing library’s own error, widened where the codec adds failure modes of its own (a too-small destination buffer, say).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".