mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-27 18:07:57 +00:00
Add TreeMap impl of Deserializable
This commit is contained in:
@@ -2,7 +2,7 @@ extern crate collections;
|
||||
|
||||
use std::hash::Hash;
|
||||
use std::num;
|
||||
use collections::HashMap;
|
||||
use collections::{HashMap, TreeMap};
|
||||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub enum Token {
|
||||
@@ -413,6 +413,21 @@ impl<
|
||||
}
|
||||
}
|
||||
|
||||
impl<
|
||||
E,
|
||||
D: Deserializer<E>,
|
||||
K: Deserializable<E, D> + Eq + TotalOrd,
|
||||
V: Deserializable<E, D>
|
||||
> Deserializable<E, D> for TreeMap<K, V> {
|
||||
#[inline]
|
||||
fn deserialize_token(d: &mut D, token: Token) -> Result<TreeMap<K, V>, E> {
|
||||
let _len = try!(d.expect_map_start(token));
|
||||
let mut value = TreeMap::new();
|
||||
|
||||
deserialize_map!(value)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
impl<
|
||||
|
||||
Reference in New Issue
Block a user