Trait serde::de::MapVisitor [−][src]
pub trait MapVisitor { type Error: Error; 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 end(&mut self) -> Result<(), Self::Error>; fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>
where
K: Deserialize,
V: Deserialize, { ... } fn size_hint(&self) -> (usize, Option<usize>) { ... } fn missing_field<V>(
&mut self,
field: &'static str
) -> Result<V, Self::Error>
where
V: Deserialize, { ... } }
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<K>(&mut self) -> Result<Option<K>, Self::Error> where
K: Deserialize,
K: Deserialize,
This returns a Ok(Some(key))
for the next key in the map, or Ok(None)
if there are no
more remaining items.
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.
fn end(&mut self) -> Result<(), Self::Error>
This signals to the MapVisitor
that the Visitor
does not expect any more items.
Provided Methods
fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error> where
K: Deserialize,
V: Deserialize,
K: Deserialize,
V: Deserialize,
This returns a Ok(Some((key, value)))
for the next (key-value) pair in the map, or
Ok(None)
if there are no more remaining items.
fn size_hint(&self) -> (usize, Option<usize>)
Return the lower and upper bound of items remaining in the sequence.
fn missing_field<V>(&mut self, field: &'static str) -> Result<V, Self::Error> where
V: Deserialize,
V: Deserialize,
Report that there
Implementations on Foreign Types
impl<'a, V_> MapVisitor for &'a mut V_ where
V_: MapVisitor,
[src]
impl<'a, V_> MapVisitor for &'a mut V_ where
V_: MapVisitor,
type Error = V_::Error
fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, V_::Error> where
K: Deserialize,
V: Deserialize,
[src]
fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, V_::Error> where
K: Deserialize,
V: Deserialize,
fn visit_key<K>(&mut self) -> Result<Option<K>, V_::Error> where
K: Deserialize,
[src]
fn visit_key<K>(&mut self) -> Result<Option<K>, V_::Error> where
K: Deserialize,
fn visit_value<V>(&mut self) -> Result<V, V_::Error> where
V: Deserialize,
[src]
fn visit_value<V>(&mut self) -> Result<V, V_::Error> where
V: Deserialize,
fn end(&mut self) -> Result<(), V_::Error>
[src]
fn end(&mut self) -> Result<(), V_::Error>
fn size_hint(&self) -> (usize, Option<usize>)
[src]
fn size_hint(&self) -> (usize, Option<usize>)
fn missing_field<V>(&mut self, field: &'static str) -> Result<V, Self::Error> where
V: Deserialize,
[src]
fn missing_field<V>(&mut self, field: &'static str) -> Result<V, Self::Error> where
V: Deserialize,
Implementors
impl<I, K, V> MapVisitor for MapDeserializer<I, K, V> where
I: Iterator<Item = (K, V)>,
K: ValueDeserializer,
V: ValueDeserializer, type Error = Error;