Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder {
    type Item;
    type Error: Error + 'static;

    // Required method
    fn decode(
        &mut self,
        src: &mut BytesMut,
    ) -> Result<Option<Self::Item>, Self::Error>;

    // Provided method
    fn decode_eof(
        &mut self,
        src: &mut BytesMut,
    ) -> Result<Option<Self::Item>, Self::Error> { ... }
}

Required Associated Types§

Source

type Item

Source

type Error: Error + 'static

Required Methods§

Source

fn decode( &mut self, src: &mut BytesMut, ) -> Result<Option<Self::Item>, Self::Error>

Provided Methods§

Source

fn decode_eof( &mut self, src: &mut BytesMut, ) -> Result<Option<Self::Item>, Self::Error>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Decoder for BytesCodec

Source§

impl Decoder for LinesCodec

Source§

impl<C> Decoder for LimitCodec<C>

Source§

impl<Enc, Dec> Decoder for CborCodec<Enc, Dec>
where for<'de> Dec: Deserialize<'de> + 'static,

Source§

impl<Enc, Dec> Decoder for JsonCodec<Enc, Dec>
where for<'de> Dec: Deserialize<'de> + 'static,

Source§

impl<L: Length> Decoder for LengthCodec<L>