Skip to main content

Codec

Trait Codec 

Source
pub trait Codec:
    Clone
    + Sync
    + Send
    + 'static {
    // Required methods
    fn encode<T: Serialize>(&self, value: &T) -> Result<Vec<u8>>;
    fn decode<T: DeserializeOwned>(&self, data: &[u8]) -> Result<T>;
}

Required Methods§

Source

fn encode<T: Serialize>(&self, value: &T) -> Result<Vec<u8>>

Source

fn decode<T: DeserializeOwned>(&self, data: &[u8]) -> Result<T>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§