1010
1111//! Implementations of serialization for structures found in libcollections
1212
13- use std:: default:: Default ;
1413use std:: hash:: Hash ;
1514
1615use { Decodable , Encodable , Decoder , Encoder } ;
1716use std:: collections:: { LinkedList , VecDeque , BTreeMap , BTreeSet , HashMap , HashSet , VecMap } ;
18- use std:: collections:: hash_state:: HashState ;
1917
2018impl <
2119 T : Encodable
@@ -128,10 +126,9 @@ impl<
128126 }
129127}
130128
131- impl < K , V , S > Encodable for HashMap < K , V , S >
129+ impl < K , V > Encodable for HashMap < K , V >
132130 where K : Encodable + Hash + Eq ,
133131 V : Encodable ,
134- S : HashState ,
135132{
136133 fn encode < E : Encoder > ( & self , e : & mut E ) -> Result < ( ) , E :: Error > {
137134 e. emit_map ( self . len ( ) , |e| {
@@ -146,15 +143,13 @@ impl<K, V, S> Encodable for HashMap<K, V, S>
146143 }
147144}
148145
149- impl < K , V , S > Decodable for HashMap < K , V , S >
146+ impl < K , V > Decodable for HashMap < K , V >
150147 where K : Decodable + Hash + Eq ,
151148 V : Decodable ,
152- S : HashState + Default ,
153149{
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 > {
155151 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) ;
158153 for i in 0 ..len {
159154 let key = try!( d. read_map_elt_key ( i, |d| Decodable :: decode ( d) ) ) ;
160155 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>
165160 }
166161}
167162
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 {
172164 fn encode < E : Encoder > ( & self , s : & mut E ) -> Result < ( ) , E :: Error > {
173165 s. emit_seq ( self . len ( ) , |s| {
174166 let mut i = 0 ;
@@ -181,14 +173,10 @@ impl<T, S> Encodable for HashSet<T, S>
181173 }
182174}
183175
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 > {
189178 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) ;
192180 for i in 0 ..len {
193181 set. insert ( try!( d. read_seq_elt ( i, |d| Decodable :: decode ( d) ) ) ) ;
194182 }
0 commit comments