Struct serde::ser::impls::MapIteratorVisitor [−][src]
pub struct MapIteratorVisitor<Iter> { /* fields omitted */ }
A serde::Visitor
for (key, value) map iterators.
Examples
use std::collections::HashMap; use serde::{Serialize, Serializer}; use serde::ser::impls::MapIteratorVisitor; struct Map(HashMap<u32, u32>); impl Serialize for Map { fn serialize<S>(&self, ser: &mut S) -> Result<(), S::Error> where S: Serializer, { ser.visit_map(MapIteratorVisitor::new( self.0.iter(), Some(self.0.len()), )) } }
Methods
impl<K, V, Iter> MapIteratorVisitor<Iter> where
Iter: Iterator<Item = (K, V)>,
[src]
impl<K, V, Iter> MapIteratorVisitor<Iter> where
Iter: Iterator<Item = (K, V)>,
pub fn new(iter: Iter, len: Option<usize>) -> MapIteratorVisitor<Iter>
[src]
pub fn new(iter: Iter, len: Option<usize>) -> MapIteratorVisitor<Iter>
Construct a new MapIteratorVisitor<Iter>
.
Trait Implementations
impl<K, V, I> MapVisitor for MapIteratorVisitor<I> where
K: Serialize,
V: Serialize,
I: Iterator<Item = (K, V)>,
[src]
impl<K, V, I> MapVisitor for MapIteratorVisitor<I> where
K: Serialize,
V: Serialize,
I: Iterator<Item = (K, V)>,
Auto Trait Implementations
impl<Iter> Send for MapIteratorVisitor<Iter> where
Iter: Send,
impl<Iter> Send for MapIteratorVisitor<Iter> where
Iter: Send,
impl<Iter> Sync for MapIteratorVisitor<Iter> where
Iter: Sync,
impl<Iter> Sync for MapIteratorVisitor<Iter> where
Iter: Sync,