pub trait Codec {
type Compact;
type Error: Into<BoxDynError>;
// Required methods
fn encode<I>(input: I) -> Result<Self::Compact, Self::Error>
where I: Serialize;
fn decode<O>(input: Self::Compact) -> Result<O, Self::Error>
where O: for<'de> Deserialize<'de>;
}
Expand description
A codec allows backends to encode and decode data
Required Associated Types§
Sourcetype Error: Into<BoxDynError>
type Error: Into<BoxDynError>
Error encountered by the codec
Required Methods§
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.