Codec

Trait Codec 

Source
pub trait Codec: Sized {
    // Required methods
    fn encode<W: Write>(&self, w: W) -> Result<usize, Error>;
    fn decode<R: Read>(r: R) -> Result<Self, Error>;
}

Required Methods§

Source

fn encode<W: Write>(&self, w: W) -> Result<usize, Error>

Source

fn decode<R: Read>(r: R) -> Result<Self, Error>

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.

Implementations on Foreign Types§

Source§

impl Codec for u32

Source§

fn encode<W: Write>(&self, w: W) -> Result<usize, Error>

Source§

fn decode<R: Read>(r: R) -> Result<Self, Error>

Source§

impl Codec for u64

Source§

fn encode<W: Write>(&self, w: W) -> Result<usize, Error>

Source§

fn decode<R: Read>(r: R) -> Result<Self, Error>

Implementors§

Source§

impl<T> Codec for WithChecksum<T>
where T: Codec,