10
10
11
11
//! Implementations of serialization for structures found in libcollections
12
12
13
- use std:: default:: Default ;
14
13
use std:: hash:: Hash ;
15
14
16
15
use { Decodable , Encodable , Decoder , Encoder } ;
17
16
use std:: collections:: { LinkedList , VecDeque , BTreeMap , BTreeSet , HashMap , HashSet , VecMap } ;
18
- use std:: collections:: hash_state:: HashState ;
19
17
20
18
impl <
21
19
T : Encodable
@@ -128,10 +126,9 @@ impl<
128
126
}
129
127
}
130
128
131
- impl < K , V , S > Encodable for HashMap < K , V , S >
129
+ impl < K , V > Encodable for HashMap < K , V >
132
130
where K : Encodable + Hash + Eq ,
133
131
V : Encodable ,
134
- S : HashState ,
135
132
{
136
133
fn encode < E : Encoder > ( & self , e : & mut E ) -> Result < ( ) , E :: Error > {
137
134
e. emit_map ( self . len ( ) , |e| {
@@ -146,15 +143,13 @@ impl<K, V, S> Encodable for HashMap<K, V, S>
146
143
}
147
144
}
148
145
149
- impl < K , V , S > Decodable for HashMap < K , V , S >
146
+ impl < K , V > Decodable for HashMap < K , V >
150
147
where K : Decodable + Hash + Eq ,
151
148
V : Decodable ,
152
- S : HashState + Default ,
153
149
{
154
- fn decode < D : Decoder > ( d : & mut D ) -> Result < HashMap < K , V , S > , D :: Error > {
150
+ fn decode < D : Decoder > ( d : & mut D ) -> Result < HashMap < K , V > , D :: Error > {
155
151
d. read_map ( |d, len| {
156
- let state = Default :: default ( ) ;
157
- let mut map = HashMap :: with_capacity_and_hash_state ( len, state) ;
152
+ let mut map = HashMap :: with_capacity ( len) ;
158
153
for i in 0 ..len {
159
154
let key = try!( d. read_map_elt_key ( i, |d| Decodable :: decode ( d) ) ) ;
160
155
let val = try!( d. read_map_elt_val ( i, |d| Decodable :: decode ( d) ) ) ;
@@ -165,10 +160,7 @@ impl<K, V, S> Decodable for HashMap<K, V, S>
165
160
}
166
161
}
167
162
168
- impl < T , S > Encodable for HashSet < T , S >
169
- where T : Encodable + Hash + Eq ,
170
- S : HashState ,
171
- {
163
+ impl < T > Encodable for HashSet < T > where T : Encodable + Hash + Eq {
172
164
fn encode < E : Encoder > ( & self , s : & mut E ) -> Result < ( ) , E :: Error > {
173
165
s. emit_seq ( self . len ( ) , |s| {
174
166
let mut i = 0 ;
@@ -181,14 +173,10 @@ impl<T, S> Encodable for HashSet<T, S>
181
173
}
182
174
}
183
175
184
- impl < T , S > Decodable for HashSet < T , S >
185
- where T : Decodable + Hash + Eq ,
186
- S : HashState + Default ,
187
- {
188
- fn decode < D : Decoder > ( d : & mut D ) -> Result < HashSet < T , S > , D :: Error > {
176
+ impl < T > Decodable for HashSet < T > where T : Decodable + Hash + Eq , {
177
+ fn decode < D : Decoder > ( d : & mut D ) -> Result < HashSet < T > , D :: Error > {
189
178
d. read_seq ( |d, len| {
190
- let state = Default :: default ( ) ;
191
- let mut set = HashSet :: with_capacity_and_hash_state ( len, state) ;
179
+ let mut set = HashSet :: with_capacity ( len) ;
192
180
for i in 0 ..len {
193
181
set. insert ( try!( d. read_seq_elt ( i, |d| Decodable :: decode ( d) ) ) ) ;
194
182
}
0 commit comments