Trait serde::de::EnumVisitor
[−]
[src]
pub trait EnumVisitor: Sized { type Error: Error; type Variant: VariantVisitor<Error=Self::Error>; fn visit_variant_seed<V>(self,
seed: V)
-> Result<(V::Value, Self::Variant), Self::Error> where V: DeserializeSeed; fn visit_variant<V>(self) -> Result<(V, Self::Variant), Self::Error> where V: Deserialize { ... } }
EnumVisitor
is a visitor that is created by the Deserializer
and passed
to the Deserialize
in order to identify which variant of an enum to
deserialize.
Associated Types
type Error: Error
The error type that can be returned if some error occurs during deserialization.
type Variant: VariantVisitor<Error=Self::Error>
The Visitor
that will be used to deserialize the content of the enum
variant.
Required Methods
fn visit_variant_seed<V>(self,
seed: V)
-> Result<(V::Value, Self::Variant), Self::Error> where V: DeserializeSeed
seed: V)
-> Result<(V::Value, Self::Variant), Self::Error> where V: DeserializeSeed
visit_variant
is called to identify which variant to deserialize.
Deserialize
implementations should typically use
EnumVisitor::visit_variant
instead.
Provided Methods
fn visit_variant<V>(self) -> Result<(V, Self::Variant), Self::Error> where V: Deserialize
visit_variant
is called to identify which variant to deserialize.
This method exists as a convenience for Deserialize
implementations.
EnumVisitor
implementations should not override the default behavior.
Implementors
impl<'a, E> EnumVisitor for StrDeserializer<'a, E> where E: Error
impl<'a, E> EnumVisitor for StringDeserializer<E> where E: Error
impl<'a, E> EnumVisitor for CowStrDeserializer<'a, E> where E: Error