Trait Decoder
Source pub trait Decoder<Item, B: IoBuf> {
type Error: From<Error>;
// Required method
fn decode(&mut self, buf: &Slice<B>) -> Result<Item, Self::Error>;
}
Expand description
Trait for decoding byte sequences back into structured items.
Errors happened during the decoding process
Decodes a byte sequence into an item.
The given buf is a sliced view into the underlying buffer, which gives
one complete frame. Slice implements IoBuf.
You may escape the view by calling Slice::as_inner.