mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-28 07:58:01 +00:00
Add {,de}serializer for VecMap
This commit is contained in:
+12
-1
@@ -1,5 +1,5 @@
|
||||
use std::collections::hash_state::HashState;
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecMap};
|
||||
use std::hash::Hash;
|
||||
use std::path;
|
||||
use std::rc::Rc;
|
||||
@@ -587,6 +587,17 @@ impl<K, V, H> Serialize for HashMap<K, V, H>
|
||||
}
|
||||
}
|
||||
|
||||
impl<V> Serialize for VecMap<V>
|
||||
where V: Serialize,
|
||||
{
|
||||
#[inline]
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
||||
where S: Serializer,
|
||||
{
|
||||
serializer.visit_map(MapIteratorVisitor::new(self.iter(), Some(self.len())))
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
impl<'a, T> Serialize for &'a T where T: Serialize {
|
||||
|
||||
Reference in New Issue
Block a user