pub trait Encoder<Item, B: IoBufMut> { type Error: From<Error>; // Required method fn encode(&mut self, item: Item, buf: &mut B) -> Result<(), Self::Error>; }
Trait for types that encode values into bytes.
The error type that can be returned during encoding operations.
Encodes an item into bytes.
The buf is guaranteed to have 0 initialized bytes (buf_len() == 0). If the function is returned successfully, all initialized bytes will be treated as valid content to be transmitted.
buf
buf_len()