Trait dencode::Decoder[][src]

pub trait Decoder {
    type Item;
    type Error: From<Error>;
    fn decode(
        &mut self,
        src: &mut BytesMut
    ) -> Result<Option<Self::Item>, Self::Error>; fn decode_eof(
        &mut self,
        src: &mut BytesMut
    ) -> Result<Option<Self::Item>, Self::Error> { ... } }
Expand description

Decoding of frames via buffers, for use with FramedRead.

Associated Types

type Item[src]

Expand description

The type of items returned by decode

type Error: From<Error>[src]

Expand description

The type of decoding errors.

Required methods

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

Expand description

Decode an item from the src BytesMut into an item

Provided methods

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

Expand description

Called when the input stream reaches EOF, signaling a last attempt to decode

Notes

The default implementation of this method invokes the Decoder::decode method.

Implementors

impl Decoder for BytesCodec[src]

type Item = Bytes

type Error = Error

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

impl Decoder for LinesCodec[src]

type Item = String

type Error = Error

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