musli_core::de

Trait EntryDecoder

Source
pub trait EntryDecoder<'de> {
    type Cx: ?Sized + Context;
    type DecodeKey<'this>: Decoder<'de, Cx = Self::Cx, Error = <Self::Cx as Context>::Error, Mode = <Self::Cx as Context>::Mode>
       where Self: 'this;
    type DecodeValue: Decoder<'de, Cx = Self::Cx, Error = <Self::Cx as Context>::Error, Mode = <Self::Cx as Context>::Mode>;

    // Required methods
    fn decode_key(
        &mut self,
    ) -> Result<Self::DecodeKey<'_>, <Self::Cx as Context>::Error>;
    fn decode_value(
        self,
    ) -> Result<Self::DecodeValue, <Self::Cx as Context>::Error>;

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

Trait governing how to decode a map entry.

Required Associated Types§

Source

type Cx: ?Sized + Context

Context associated with the decoder.

Source

type DecodeKey<'this>: Decoder<'de, Cx = Self::Cx, Error = <Self::Cx as Context>::Error, Mode = <Self::Cx as Context>::Mode> where Self: 'this

The decoder to use for a tuple field index.

Source

type DecodeValue: Decoder<'de, Cx = Self::Cx, Error = <Self::Cx as Context>::Error, Mode = <Self::Cx as Context>::Mode>

The decoder to use for a tuple field value.

Required Methods§

Source

fn decode_key( &mut self, ) -> Result<Self::DecodeKey<'_>, <Self::Cx as Context>::Error>

Return the decoder for the first value in the pair.

If this is a map the first value would be the key of the map, if this is a struct the first value would be the field of the struct.

Source

fn decode_value(self) -> Result<Self::DecodeValue, <Self::Cx as Context>::Error>

Decode the second value in the pair..

Provided Methods§

Source

fn size_hint(&self) -> SizeHint

Get a size hint for the size of the map being decoded.

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§