Add TreeMap impl of Deserializable

This commit is contained in:
Erick Tryzelaar 2014-05-26 12:53:37 -07:00
parent 0bda36d6d3
commit 0d56ae5986

17
de.rs
View File

@ -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<