Trait async_codec::AsyncDecode [] [src]

pub trait AsyncDecode where
    Self: Sized
{ type Item; type Error; fn poll_decode<R: AsyncRead>(
        self,
        cx: &mut Context,
        reader: &mut R
    ) -> PollDec<Self::Item, Self, Self::Error>; }

A trait for types can be asynchronously decoded from an AsyncRead.

Associated Types

The type of the value to decode.

An error indicating how decoding can fail.

Required Methods

Call reader.poll_read exactly once, propgating any Err and Pending, and return how many bytes have been read, as well as the decoded value, once decoding is done.

This consumes ownership of the decoder. If decoding did not terminate, the return value contains a new decoder that will resume at the correct point.

If reader.poll_read returns Ok(Ready(0)) even though the value has not been fully decoded, this must return an error of kind UnexpectedEof.

Implementors