Trait streamdata::Decoder

source ·
pub trait Decoder<Input>where
    Input: Buffer,{
    type Value;
    type Error;

    // Required method
    fn decode(
        &mut self,
        input: &mut Input
    ) -> Result<Self::Value, DecodeError<Self::Error>>;
}
Expand description

Decoder represents the ability to decode a value from a given buffer of data.

Required Associated Types§

source

type Value

The value to decode.

source

type Error

The error that can occur while decoding the value.

Required Methods§

source

fn decode( &mut self, input: &mut Input ) -> Result<Self::Value, DecodeError<Self::Error>>

Decode (up to one) value from the buffer, returning the decoded value accompanied by the amount of bytes consumed from the buf on success, or a relevant decoding error.

Implementors§

source§

impl<T> Decoder<Vec<u8, Global>> for streamdata::decoder::tokio_util::Decoder<T>where T: Decoder,

§

type Value = <T as Decoder>::Item

§

type Error = <T as Decoder>::Error

source§

impl<T> Decoder<BytesMut> for streamdata::decoder::tokio_util::Decoder<T>where T: Decoder,

§

type Value = <T as Decoder>::Item

§

type Error = <T as Decoder>::Error

source§

impl<T, Buffer> Decoder<Buffer> for streamdata::decoder::serde_json::Decoder<T>where T: for<'de> Deserialize<'de>, Buffer: Buffer,

§

type Value = T

§

type Error = Error