pub trait SumAccess<'de> {
    type Error: Error;
    type Variant: VariantAccess<'de, Error = Self::Error>;

    // Required method
    fn variant<V: VariantVisitor>(
        self,
        visitor: V
    ) -> Result<(V::Output, Self::Variant), Self::Error>;
}
Expand description

Provides a SumVisitor access to the data of a sum in the input.

An A: SumAccess object is created by the [D: Deserializer] which passes A to a [V: SumVisitor] that D in turn was passed. A is then used by V to split tag and value input apart.

Required Associated Types§

source

type Error: Error

The error type that can be returned if some error occurs during deserialization.

source

type Variant: VariantAccess<'de, Error = Self::Error>

The visitor used to deserialize the content of the sum variant.

Required Methods§

source

fn variant<V: VariantVisitor>( self, visitor: V ) -> Result<(V::Output, Self::Variant), Self::Error>

Called to identify which variant to deserialize. Returns a tuple with the result of identification (V::Output) and the input to variant data deserialization.

The visitor is provided by the Deserializer. This method is typically called from SumVisitor::visit_sum which will provide the V: VariantVisitor.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'de, 'a, R: BufReader<'de>> SumAccess<'de> for Deserializer<'a, R>