Trait destream::de::SeqAccess

source ·
pub trait SeqAccess: Send {
    type Error: Error;

    // Required method
    fn next_element<'life0, 'async_trait, T>(
        &'life0 mut self,
        context: T::Context
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Self::Error>> + Send + 'async_trait>>
       where T: 'async_trait + FromStream,
             Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn expect_next<'life0, 'async_trait, T>(
        &'life0 mut self,
        context: T::Context
    ) -> Pin<Box<dyn Future<Output = Result<T, Self::Error>> + Send + 'async_trait>>
       where T: 'async_trait + FromStream,
             Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn size_hint(&self) -> Option<usize> { ... }
}
Expand description

Provides a Visitor access to each element of a sequence in the input.

This is a trait that a Decoder passes to a Visitor implementation, which decodes each item in a sequence.

Based on serde::de::SeqAccess.

Required Associated Types§

source

type Error: Error

The type to return if decoding encounters an error.

Required Methods§

source

fn next_element<'life0, 'async_trait, T>( &'life0 mut self, context: T::Context ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + FromStream, Self: 'async_trait, 'life0: 'async_trait,

Returns Ok(Some(value)) for the next value in the sequence, or Ok(None) if there is no next item of type T.

context is the decoder context used by T’s FromStream impl. If T is small enough to fit in main memory, pass the unit context ().

Provided Methods§

source

fn expect_next<'life0, 'async_trait, T>( &'life0 mut self, context: T::Context ) -> Pin<Box<dyn Future<Output = Result<T, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + FromStream, Self: 'async_trait, 'life0: 'async_trait,

Returns Ok(Some(value)) for the next value in the sequence, or an error if there is no next item or it’s not the required type.

context is the decoder context used by T’s FromStream impl. If T is small enough to fit in main memory, pass the unit context ().

source

fn size_hint(&self) -> Option<usize>

Returns the number of elements remaining in the sequence, if known.

Object Safety§

This trait is not object safe.

Implementors§