musli_core::de

Trait MapDecoder

Source
pub trait MapDecoder<'de> {
    type Cx: ?Sized + Context;
    type DecodeEntry<'this>: EntryDecoder<'de, Cx = Self::Cx>
       where Self: 'this;
    type DecodeRemainingEntries<'this>: EntriesDecoder<'de, Cx = Self::Cx>
       where Self: 'this;

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

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

Trait governing how to decode a sequence of pairs.

Required Associated Types§

Source

type Cx: ?Sized + Context

Context associated with the decoder.

Source

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

The decoder to use for a key.

Source

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

Required Methods§

Source

fn decode_entry( &mut self, ) -> Result<Option<Self::DecodeEntry<'_>>, <Self::Cx as Context>::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::Cx as Context>::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::Cx as Context>::Error>
where K: Decode<'de, <Self::Cx as Context>::Mode>, V: Decode<'de, <Self::Cx as Context>::Mode>,

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§