Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder {
    type Item: Debug;
    type Error: Debug;

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

Decoding of frames via buffers.

Required Associated Types§

Source

type Item: Debug

The type of decoded frames.

Source

type Error: Debug

The type of unrecoverable frame decoding errors.

If an individual message is ill-formed but can be ignored without interfering with the processing of future messages, it may be more useful to report the failure as an Item.

Required Methods§

Source

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

Attempts to decode a frame from the provided buffer of bytes.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> Decoder for Rc<T>
where T: Decoder,

Source§

type Item = <T as Decoder>::Item

Source§

type Error = <T as Decoder>::Error

Source§

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

Implementors§