Trait diny_core::backend::Decode[][src]

pub trait Decode: Sized {
    type Format: FormatDecode;
    type Data;
    fn init() -> Self;
fn poll_decode<R>(
        &mut self,
        format: &Self::Format,
        reader: &mut R,
        cx: &mut Context<'_>
    ) -> PollDecodeStatus<Self::Data, <<Self as Decode>::Format as Format>::Error>
    where
        R: AsyncBufRead + Unpin
; fn start_decode<R>(
        format: &Self::Format,
        reader: &mut R,
        cx: &mut Context<'_>
    ) -> StartDecodeStatus<Self::Data, Self, <<Self as Decode>::Format as Format>::Error>
    where
        R: AsyncBufRead + Unpin
, { ... } }
Expand description

Attempt to decode a data structure from an asynchronous reader for a particular format

Associated Types

The concrete format to decode with.

The concrete data structure to decode.

Required methods

Initialize the internal state of the decoder.

Continue a pending Decode operation.

Provided methods

Begin decoding bytes for the indicated format from the provided reader.

This is intended to be overriden whenever an optimized code path exists for the (usual) case where enough bytes have been buffered into the reader that the operation will succeed immediately without pending.

Implementation

Implementions must ensure that start_decode is semantically equivalent to calling init followed by poll_decode

Implementors