pub trait Codec {
type Value;
type Encoded: AsRef<[u8]>;
// Required methods
fn encode(d: &Self::Value) -> Option<Self::Encoded>;
fn decode(bytes: &[u8]) -> Option<Self::Value>;
}Expand description
A trait that defines how types are decoded/encoded.
Required Associated Types§
Required Methods§
fn encode(d: &Self::Value) -> Option<Self::Encoded>
fn decode(bytes: &[u8]) -> Option<Self::Value>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.