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_newtype<T>(&mut self) -> Result<T, Self::Error>
where
T: Deserialize, { ... } fn visit_tuple<V>(
&mut self,
_len: usize,
_visitor: V
) -> Result<V::Value, Self::Error>
where
V: Visitor, { ... } fn visit_struct<V>(
&mut self,
_fields: &'static [&'static str],
_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
Required Methods
fn visit_variant<V>(&mut self) -> Result<V, Self::Error> where
V: Deserialize,
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_newtype<T>(&mut self) -> Result<T, Self::Error> where
T: Deserialize,
T: Deserialize,
visit_newtype
is called when deserializing a variant with a single value. By default this
uses the visit_tuple
method to deserialize the value.
fn visit_tuple<V>(
&mut self,
_len: usize,
_visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor,
&mut self,
_len: usize,
_visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor,
visit_tuple
is called when deserializing a tuple-like variant.
fn visit_struct<V>(
&mut self,
_fields: &'static [&'static str],
_visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor,
&mut self,
_fields: &'static [&'static str],
_visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor,
visit_struct
is called when deserializing a struct-like variant.
Implementations on Foreign Types
impl<'a, T> VariantVisitor for &'a mut T where
T: VariantVisitor,
[src]
impl<'a, T> VariantVisitor for &'a mut T where
T: VariantVisitor,
type Error = T::Error
fn visit_variant<V>(&mut self) -> Result<V, T::Error> where
V: Deserialize,
[src]
fn visit_variant<V>(&mut self) -> Result<V, T::Error> where
V: Deserialize,
fn visit_unit(&mut self) -> Result<(), T::Error>
[src]
fn visit_unit(&mut self) -> Result<(), T::Error>
fn visit_newtype<D>(&mut self) -> Result<D, T::Error> where
D: Deserialize,
[src]
fn visit_newtype<D>(&mut self) -> Result<D, T::Error> where
D: Deserialize,
fn visit_tuple<V>(
&mut self,
len: usize,
visitor: V
) -> Result<V::Value, T::Error> where
V: Visitor,
[src]
fn visit_tuple<V>(
&mut self,
len: usize,
visitor: V
) -> Result<V::Value, T::Error> where
V: Visitor,
fn visit_struct<V>(
&mut self,
fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, T::Error> where
V: Visitor,
[src]
fn visit_struct<V>(
&mut self,
fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, T::Error> where
V: Visitor,
Implementors
impl<'a> VariantVisitor for StrDeserializer<'a> type Error = Error;
impl<'a> VariantVisitor for StringDeserializer type Error = Error;