pub trait Decoder<Item = Self> {
type Error;
// Required method
fn decode(buf: &mut BytesMut) -> Result<Item, Self::Error>;
// Provided method
fn has_enough_bytes(_buf: &BytesMut) -> bool { ... }
}Expand description
A trait for types that can decode values of type [Decoder::Output] from
a bytes buffer of type Bytes.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn has_enough_bytes(_buf: &BytesMut) -> bool
fn has_enough_bytes(_buf: &BytesMut) -> bool
Returns true if the given buffer can be decoded.
This is used to determine if the buffer has enough bytes to decode a value.