Trait serde::de::VariantVisitor [] [src]

pub trait VariantVisitor {
    type Error: Error;
    fn visit_variant<V>(&mut self) -> Result<V, Self::Error> where V: Deserialize;

    fn visit_unit(&mut self) -> Result<(), Self::Error> { ... }
    fn visit_seq<V>(&mut self, _visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
    fn visit_map<V>(&mut self, _visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
}

VariantVisitor is a visitor that is created by the Deserializer and passed to the Deserialize in order to deserialize a specific enum variant.

Associated Types

type Error: Error

Required Methods

fn visit_variant<V>(&mut self) -> Result<V, Self::Error> where V: Deserialize

visit_variant is called to identify which variant to deserialize.

Provided Methods

fn visit_unit(&mut self) -> Result<(), Self::Error>

visit_unit is called when deserializing a variant with no values.

fn visit_seq<V>(&mut self, _visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

visit_seq is called when deserializing a tuple-like variant.

fn visit_map<V>(&mut self, _visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

visit_map is called when deserializing a struct-like variant.

Implementors