1010
1111//! Implementations of serialization for structures found in libcollections
1212
13- use std:: hash:: Hash ;
14- use std:: collections:: hash_state:: HashState ;
13+ use std:: hash:: { Hash , BuildHasher } ;
1514use std:: mem;
1615
1716use { Decodable , Encodable , Decoder , Encoder } ;
@@ -159,7 +158,7 @@ impl<
159158impl < K , V , S > Encodable for HashMap < K , V , S >
160159 where K : Encodable + Hash + Eq ,
161160 V : Encodable ,
162- S : HashState ,
161+ S : BuildHasher ,
163162{
164163 fn encode < E : Encoder > ( & self , e : & mut E ) -> Result < ( ) , E :: Error > {
165164 e. emit_map ( self . len ( ) , |e| {
@@ -177,12 +176,12 @@ impl<K, V, S> Encodable for HashMap<K, V, S>
177176impl < K , V , S > Decodable for HashMap < K , V , S >
178177 where K : Decodable + Hash + Eq ,
179178 V : Decodable ,
180- S : HashState + Default ,
179+ S : BuildHasher + Default ,
181180{
182181 fn decode < D : Decoder > ( d : & mut D ) -> Result < HashMap < K , V , S > , D :: Error > {
183182 d. read_map ( |d, len| {
184183 let state = Default :: default ( ) ;
185- let mut map = HashMap :: with_capacity_and_hash_state ( len, state) ;
184+ let mut map = HashMap :: with_capacity_and_hasher ( len, state) ;
186185 for i in 0 ..len {
187186 let key = try!( d. read_map_elt_key ( i, |d| Decodable :: decode ( d) ) ) ;
188187 let val = try!( d. read_map_elt_val ( i, |d| Decodable :: decode ( d) ) ) ;
@@ -195,7 +194,7 @@ impl<K, V, S> Decodable for HashMap<K, V, S>
195194
196195impl < T , S > Encodable for HashSet < T , S >
197196 where T : Encodable + Hash + Eq ,
198- S : HashState ,
197+ S : BuildHasher ,
199198{
200199 fn encode < E : Encoder > ( & self , s : & mut E ) -> Result < ( ) , E :: Error > {
201200 s. emit_seq ( self . len ( ) , |s| {
@@ -211,12 +210,12 @@ impl<T, S> Encodable for HashSet<T, S>
211210
212211impl < T , S > Decodable for HashSet < T , S >
213212 where T : Decodable + Hash + Eq ,
214- S : HashState + Default ,
213+ S : BuildHasher + Default ,
215214{
216215 fn decode < D : Decoder > ( d : & mut D ) -> Result < HashSet < T , S > , D :: Error > {
217216 d. read_seq ( |d, len| {
218217 let state = Default :: default ( ) ;
219- let mut set = HashSet :: with_capacity_and_hash_state ( len, state) ;
218+ let mut set = HashSet :: with_capacity_and_hasher ( len, state) ;
220219 for i in 0 ..len {
221220 set. insert ( try!( d. read_seq_elt ( i, |d| Decodable :: decode ( d) ) ) ) ;
222221 }
0 commit comments