pub trait CodecType:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn encode<T: Serialize>(value: &T) -> Result<Vec<u8>>;
fn decode<T: DeserializeOwned>(data: &[u8]) -> Result<T>;
}Expand description
Marker trait for codec types.
This trait is implemented by codec marker types like MsgPackCodec and [JsonCodec].
It provides the actual encode/decode functionality.
Required Methods§
Sourcefn decode<T: DeserializeOwned>(data: &[u8]) -> Result<T>
fn decode<T: DeserializeOwned>(data: &[u8]) -> Result<T>
Decode a value from bytes.
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.
Implementors§
impl CodecType for MsgPackCodec
Available on crate feature
msgpack only.