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§
Sourcefn decode(buf: &[u8], header_len: usize) -> Result<Self, Error>where
Self: Default,
fn decode(buf: &[u8], header_len: usize) -> Result<Self, Error>where
Self: Default,
decode header(if exists) and body
Sourcefn encoded_len(&self) -> u32where
Self: Sized,
fn encoded_len(&self) -> u32where
Self: Sized,
encoded length