Codec

Trait Codec 

Source
pub trait Codec: Serialize + DeserializeOwned {
    // Provided methods
    fn encode(&self) -> Result<Vec<u8>> { ... }
    fn decode(value: &[u8]) -> Result<Self> { ... }
}
Expand description

Trait for types that can be encoded and decoded using serde-jam

Provided Methods§

Source

fn encode(&self) -> Result<Vec<u8>>

Encode the value into a byte vector

Source

fn decode(value: &[u8]) -> Result<Self>

Decode the value from a byte vector

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§