@@ -65,8 +65,6 @@ use std::vec::{Items, MutItems};
65
65
use std:: vec_ng:: Vec ;
66
66
use std:: vec_ng;
67
67
68
- use serialize:: { Encodable , Decodable , Encoder , Decoder } ;
69
-
70
68
static INITIAL_CAPACITY : uint = 32 u; // 2^5
71
69
72
70
struct Bucket < K , V > {
@@ -912,71 +910,6 @@ pub type SetAlgebraItems<'a, T> =
912
910
FilterMap < ' static , ( & ' a HashSet < T > , & ' a T ) , & ' a T ,
913
911
Zip < Repeat < & ' a HashSet < T > > , SetItems < ' a , T > > > ;
914
912
915
- impl <
916
- E : Encoder ,
917
- K : Encodable < E > + Hash + Eq ,
918
- V : Encodable < E >
919
- > Encodable < E > for HashMap < K , V > {
920
- fn encode ( & self , e : & mut E ) {
921
- e. emit_map ( self . len ( ) , |e| {
922
- let mut i = 0 ;
923
- for ( key, val) in self . iter ( ) {
924
- e. emit_map_elt_key ( i, |e| key. encode ( e) ) ;
925
- e. emit_map_elt_val ( i, |e| val. encode ( e) ) ;
926
- i += 1 ;
927
- }
928
- } )
929
- }
930
- }
931
-
932
- impl <
933
- D : Decoder ,
934
- K : Decodable < D > + Hash + Eq ,
935
- V : Decodable < D >
936
- > Decodable < D > for HashMap < K , V > {
937
- fn decode ( d : & mut D ) -> HashMap < K , V > {
938
- d. read_map ( |d, len| {
939
- let mut map = HashMap :: with_capacity ( len) ;
940
- for i in range ( 0 u, len) {
941
- let key = d. read_map_elt_key ( i, |d| Decodable :: decode ( d) ) ;
942
- let val = d. read_map_elt_val ( i, |d| Decodable :: decode ( d) ) ;
943
- map. insert ( key, val) ;
944
- }
945
- map
946
- } )
947
- }
948
- }
949
-
950
- impl <
951
- S : Encoder ,
952
- T : Encodable < S > + Hash + Eq
953
- > Encodable < S > for HashSet < T > {
954
- fn encode ( & self , s : & mut S ) {
955
- s. emit_seq ( self . len ( ) , |s| {
956
- let mut i = 0 ;
957
- for e in self . iter ( ) {
958
- s. emit_seq_elt ( i, |s| e. encode ( s) ) ;
959
- i += 1 ;
960
- }
961
- } )
962
- }
963
- }
964
-
965
- impl <
966
- D : Decoder ,
967
- T : Decodable < D > + Hash + Eq
968
- > Decodable < D > for HashSet < T > {
969
- fn decode ( d : & mut D ) -> HashSet < T > {
970
- d. read_seq ( |d, len| {
971
- let mut set = HashSet :: with_capacity ( len) ;
972
- for i in range ( 0 u, len) {
973
- set. insert ( d. read_seq_elt ( i, |d| Decodable :: decode ( d) ) ) ;
974
- }
975
- set
976
- } )
977
- }
978
- }
979
-
980
913
#[ cfg( test) ]
981
914
mod test_map {
982
915
use super :: { HashMap , HashSet } ;
0 commit comments