mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-25 13:57:55 +00:00
add impls for {Hash,Tree}Sets
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::collections::{HashMap, TreeMap};
|
||||
use std::collections::{HashMap, HashSet, TreeMap, TreeSet};
|
||||
use std::gc::{GC, Gc};
|
||||
use std::hash::Hash;
|
||||
use std::num;
|
||||
@@ -588,6 +588,32 @@ impl<
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
impl<
|
||||
T: Deserializable + Eq + Hash
|
||||
> Deserializable for HashSet<T> {
|
||||
#[inline]
|
||||
fn deserialize_token<
|
||||
D: Deserializer<E>,
|
||||
E
|
||||
>(d: &mut D, token: Token) -> Result<HashSet<T>, E> {
|
||||
d.expect_seq(token)
|
||||
}
|
||||
}
|
||||
|
||||
impl<
|
||||
T: Deserializable + Ord
|
||||
> Deserializable for TreeSet<T> {
|
||||
#[inline]
|
||||
fn deserialize_token<
|
||||
D: Deserializer<E>,
|
||||
E
|
||||
>(d: &mut D, token: Token) -> Result<TreeSet<T>, E> {
|
||||
d.expect_seq(token)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
macro_rules! peel {
|
||||
($name:ident, $($other:ident,)*) => (impl_deserialize_tuple!($($other,)*))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user