MapDecoder

Trait MapDecoder 

Source
pub trait MapDecoder<'de> {
    type Cx: Context<Error = Self::Error, Allocator = Self::Allocator>;
    type Error;
    type Allocator: Allocator;
    type Mode: 'static;
    type DecodeEntry<'this>: EntryDecoder<'de, Cx = Self::Cx, Error = Self::Error, Allocator = Self::Allocator, Mode = Self::Mode>
       where Self: 'this;
    type DecodeRemainingEntries<'this>: EntriesDecoder<'de, Cx = Self::Cx, Error = Self::Error, Allocator = Self::Allocator, Mode = Self::Mode>
       where Self: 'this;

    // Required methods
    fn cx(&self) -> Self::Cx;
    fn decode_entry(
        &mut self,
    ) -> Result<Option<Self::DecodeEntry<'_>>, Self::Error>;
    fn decode_remaining_entries(
        &mut self,
    ) -> Result<Self::DecodeRemainingEntries<'_>, Self::Error>;

    // Provided methods
    fn size_hint(&self) -> SizeHint { ... }
    fn entry<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>
       where K: Decode<'de, Self::Mode, Self::Allocator>,
             V: Decode<'de, Self::Mode, Self::Allocator> { ... }
}
Expand description

Trait governing how to decode a sequence of pairs.

Required Associated Types§

Source

type Cx: Context<Error = Self::Error, Allocator = Self::Allocator>

Context associated with the decoder.

Source

type Error

Error associated with decoding.

Source

type Allocator: Allocator

The allocator associated with the decoder.

Source

type Mode: 'static

The mode of the decoder.

Source

type DecodeEntry<'this>: EntryDecoder<'de, Cx = Self::Cx, Error = Self::Error, Allocator = Self::Allocator, Mode = Self::Mode> where Self: 'this

The decoder to use for a key.

Source

type DecodeRemainingEntries<'this>: EntriesDecoder<'de, Cx = Self::Cx, Error = Self::Error, Allocator = Self::Allocator, Mode = Self::Mode> where Self: 'this

Required Methods§

Source

fn cx(&self) -> Self::Cx

Access the context associated with the decoder.

Source

fn decode_entry(&mut self) -> Result<Option<Self::DecodeEntry<'_>>, Self::Error>

Decode the next key. This returns Ok(None) where there are no more elements to decode.

Source

fn decode_remaining_entries( &mut self, ) -> Result<Self::DecodeRemainingEntries<'_>, Self::Error>

Return simplified decoder for remaining entries.

Provided Methods§

Source

fn size_hint(&self) -> SizeHint

Get a size hint of known remaining elements.

Source

fn entry<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>
where K: Decode<'de, Self::Mode, Self::Allocator>, V: Decode<'de, Self::Mode, Self::Allocator>,

Decode the next map entry as a tuple.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§