Trait async_codec::AsyncDecode [] [src]

pub trait AsyncDecode<R: AsyncRead> {
    type Item;
    type Error;
    fn poll_decode(
        &mut self,
        cx: &mut Context,
        reader: &mut R
    ) -> Poll<(Option<Self::Item>, usize), DecodeError<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 method may not be called after a value has been decoded.

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