Struct serde::ser::impls::MapIteratorVisitor
[−]
[src]
pub struct MapIteratorVisitor<Iter> { // some 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)>
fn new(iter: Iter, len: Option<usize>) -> MapIteratorVisitor<Iter>
Construct a new MapIteratorVisitor<Iter>
.