pub trait Decoder {
type Item;
type Error: From<Error>;
// Required method
fn decode(
&mut self,
src: &mut BytesMut,
) -> Result<Option<Self::Item>, Self::Error>;
// Provided method
fn decode_eof(
&mut self,
buf: &mut BytesMut,
) -> Result<Option<Self::Item>, Self::Error> { ... }
}
Available on (crate features
async_io
or async_tokio
) and crate feature async_framed
only.