Trait serde::de::MapVisitor
[−]
[src]
pub trait MapVisitor { type Error: Error; fn visit_key_seed<K>(
&mut self,
seed: K
) -> Result<Option<K::Value>, Self::Error>
where
K: DeserializeSeed; fn visit_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error>
where
V: DeserializeSeed; fn visit_seed<K, V>(
&mut self,
kseed: K,
vseed: V
) -> Result<Option<(K::Value, V::Value)>, Self::Error>
where
K: DeserializeSeed,
V: DeserializeSeed, { ... } fn visit_key<K>(&mut self) -> Result<Option<K>, Self::Error>
where
K: Deserialize, { ... } fn visit_value<V>(&mut self) -> Result<V, Self::Error>
where
V: Deserialize, { ... } fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>
where
K: Deserialize,
V: Deserialize, { ... } fn size_hint(&self) -> (usize, Option<usize>) { ... } }
MapVisitor
visits each item in a sequence.
This is a trait that a Deserializer
passes to a Visitor
implementation.
Associated Types
Required Methods
fn visit_key_seed<K>(
&mut self,
seed: K
) -> Result<Option<K::Value>, Self::Error> where
K: DeserializeSeed,
&mut self,
seed: K
) -> Result<Option<K::Value>, Self::Error> where
K: DeserializeSeed,
This returns Ok(Some(key))
for the next key in the map, or Ok(None)
if there are no more remaining entries.
Deserialize
implementations should typically use
MapVisitor::visit_key
or MapVisitor::visit
instead.
fn visit_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error> where
V: DeserializeSeed,
V: DeserializeSeed,
This returns a Ok(value)
for the next value in the map.
Deserialize
implementations should typically use
MapVisitor::visit_value
instead.
Provided Methods
fn visit_seed<K, V>(
&mut self,
kseed: K,
vseed: V
) -> Result<Option<(K::Value, V::Value)>, Self::Error> where
K: DeserializeSeed,
V: DeserializeSeed,
&mut self,
kseed: K,
vseed: V
) -> Result<Option<(K::Value, V::Value)>, Self::Error> where
K: DeserializeSeed,
V: DeserializeSeed,
This returns Ok(Some((key, value)))
for the next (key-value) pair in
the map, or Ok(None)
if there are no more remaining items.
MapVisitor
implementations should override the default behavior if a
more efficient implementation is possible.
Deserialize
implementations should typically use MapVisitor::visit
instead.
fn visit_key<K>(&mut self) -> Result<Option<K>, Self::Error> where
K: Deserialize,
K: Deserialize,
This returns Ok(Some(key))
for the next key in the map, or Ok(None)
if there are no more remaining entries.
This method exists as a convenience for Deserialize
implementations.
MapVisitor
implementations should not override the default behavior.
fn visit_value<V>(&mut self) -> Result<V, Self::Error> where
V: Deserialize,
V: Deserialize,
This returns a Ok(value)
for the next value in the map.
This method exists as a convenience for Deserialize
implementations.
MapVisitor
implementations should not override the default behavior.
fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error> where
K: Deserialize,
V: Deserialize,
K: Deserialize,
V: Deserialize,
This returns Ok(Some((key, value)))
for the next (key-value) pair in
the map, or Ok(None)
if there are no more remaining items.
This method exists as a convenience for Deserialize
implementations.
MapVisitor
implementations should not override the default behavior.
fn size_hint(&self) -> (usize, Option<usize>)
Return the lower and upper bound of items remaining in the sequence.
Implementations on Foreign Types
impl<'a, V_> MapVisitor for &'a mut V_ where
V_: MapVisitor,
[src]
V_: MapVisitor,
type Error = V_::Error
fn visit_key_seed<K>(
&mut self,
seed: K
) -> Result<Option<K::Value>, Self::Error> where
K: DeserializeSeed,
[src]
&mut self,
seed: K
) -> Result<Option<K::Value>, Self::Error> where
K: DeserializeSeed,
fn visit_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error> where
V: DeserializeSeed,
[src]
V: DeserializeSeed,
fn visit_seed<K, V>(
&mut self,
kseed: K,
vseed: V
) -> Result<Option<(K::Value, V::Value)>, Self::Error> where
K: DeserializeSeed,
V: DeserializeSeed,
[src]
&mut self,
kseed: K,
vseed: V
) -> Result<Option<(K::Value, V::Value)>, Self::Error> where
K: DeserializeSeed,
V: DeserializeSeed,
fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, V_::Error> where
K: Deserialize,
V: Deserialize,
[src]
K: Deserialize,
V: Deserialize,
fn visit_key<K>(&mut self) -> Result<Option<K>, V_::Error> where
K: Deserialize,
[src]
K: Deserialize,
fn visit_value<V>(&mut self) -> Result<V, V_::Error> where
V: Deserialize,
[src]
V: Deserialize,
fn size_hint(&self) -> (usize, Option<usize>)
[src]
Implementors
impl<I, E> MapVisitor for MapDeserializer<I, E> where
I: Iterator,
I::Item: Pair,
<I::Item as Pair>::First: ValueDeserializer<E>,
<I::Item as Pair>::Second: ValueDeserializer<E>,
E: Error, type Error = E;