Trait Framed

Source
pub trait Framed:
    Debug
    + Send
    + Sync {
    // Required methods
    fn decode(buf: &[u8], header_len: usize) -> Result<Self, Error>
       where Self: Default;
    fn encoded_len(&self) -> u32
       where Self: Sized;
    fn encode<B>(&self, buf: &mut B) -> Result<(), Error>
       where B: BufMut,
             Self: Sized;
}
Expand description

encode and decode for frame

Required Methods§

Source

fn decode(buf: &[u8], header_len: usize) -> Result<Self, Error>
where Self: Default,

decode header(if exists) and body

Source

fn encoded_len(&self) -> u32
where Self: Sized,

encoded length

Source

fn encode<B>(&self, buf: &mut B) -> Result<(), Error>
where B: BufMut, Self: Sized,

encode header and body, with length

Implementors§

Source§

impl<H, T> Framed for Frame<H, T>