Trait musli_core::de::VariantDecoder

source ·
pub trait VariantDecoder<'de> {
    type Cx: ?Sized + Context;
    type DecodeTag<'this>: Decoder<'de, Cx = Self::Cx, Error = <Self::Cx as Context>::Error, Mode = <Self::Cx as Context>::Mode>
       where Self: 'this;
    type DecodeValue<'this>: Decoder<'de, Cx = Self::Cx, Error = <Self::Cx as Context>::Error, Mode = <Self::Cx as Context>::Mode>
       where Self: 'this;

    // Required methods
    fn decode_tag(
        &mut self,
    ) -> Result<Self::DecodeTag<'_>, <Self::Cx as Context>::Error>;
    fn decode_value(
        &mut self,
    ) -> Result<Self::DecodeValue<'_>, <Self::Cx as Context>::Error>;
}
Expand description

Trait governing how to decode a variant.

Required Associated Types§

source

type Cx: ?Sized + Context

Context associated with the decoder.

source

type DecodeTag<'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 the variant tag.

source

type DecodeValue<'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 the variant value.

Required Methods§

source

fn decode_tag( &mut self, ) -> Result<Self::DecodeTag<'_>, <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( &mut self, ) -> Result<Self::DecodeValue<'_>, <Self::Cx as Context>::Error>

Decode the second value in the pair..

Object Safety§

This trait is not object safe.

Implementors§