Trait destream::de::MapAccess

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

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

    // Provided method
    fn size_hint(&self) -> Option<usize> { ... }
}
Expand description

Provides a Visitor with access to each entry of a map in the input.

This is a trait that a Decoder passes to a Visitor implementation.

Based on serde::de::MapAccess.

Required Associated Types§

source

type Error: Error

Type to return in case of a decoding error.

Required Methods§

source

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

This returns Ok(Some(key)) for the next key in the map, or Ok(None) if there are no more remaining entries.

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

source

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

This returns Ok(value) for the next value in the map.

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

Panics

Calling next_value before next_key is incorrect and is allowed to panic or return bogus results.

Provided Methods§

source

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

Returns the number of entries remaining in the map, if known.

Object Safety§

This trait is not object safe.

Implementors§