mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 23:35:26 +00:00
Add TreeMap impl of Deserializable
This commit is contained in:
parent
0bda36d6d3
commit
0d56ae5986
17
de.rs
17
de.rs
@ -2,7 +2,7 @@ extern crate collections;
|
|||||||
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::num;
|
use std::num;
|
||||||
use collections::HashMap;
|
use collections::{HashMap, TreeMap};
|
||||||
|
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, Eq)]
|
||||||
pub enum Token {
|
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<
|
impl<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user