Skip to main content

CodecFor

Trait CodecFor 

Source
pub trait CodecFor<T>: Codec {
    type Decoded<'buf>: 'buf
       where T: 'buf;

    // Required methods
    fn encode(msg: &T, buf: &mut [u8]) -> Result<usize, Self::Error>;
    fn decode<'buf>(buf: &'buf [u8]) -> Result<Self::Decoded<'buf>, Self::Error>
       where T: 'buf;
}

Required Associated Types§

Source

type Decoded<'buf>: 'buf where T: 'buf

Required Methods§

Source

fn encode(msg: &T, buf: &mut [u8]) -> Result<usize, Self::Error>

Source

fn decode<'buf>(buf: &'buf [u8]) -> Result<Self::Decoded<'buf>, Self::Error>
where T: 'buf,

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§