Decoder

Trait 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>> for streamdata::decoder::tokio_util::Decoder<T>
where T: Decoder,

Source§

type Value = <T as Decoder>::Item

Source§

type Error = <T as Decoder>::Error

Source§

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

Source§

type Value = <T as Decoder>::Item

Source§

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,