pub trait VariantVisitor {
    type Output;

    // Required methods
    fn variant_names(&self, names: &mut dyn ValidNames);
    fn visit_tag<E: Error>(self, tag: u8) -> Result<Self::Output, E>;
    fn visit_name<E: Error>(self, name: &str) -> Result<Self::Output, E>;
}
Expand description

A visitor passed from SumVisitor to SumAccess::variant which the latter uses to decide what variant to deserialize.

Required Associated Types§

source

type Output

The result of identifying a variant, e.g., some index type.

Required Methods§

source

fn variant_names(&self, names: &mut dyn ValidNames)

Provides the visitor the chance to add valid names into names.

source

fn visit_tag<E: Error>(self, tag: u8) -> Result<Self::Output, E>

Identify the variant based on tag.

source

fn visit_name<E: Error>(self, name: &str) -> Result<Self::Output, E>

Identify the variant based on name.

Object Safety§

This trait is not object safe.

Implementors§