1616use container:: { Container , Mutable , Map , Set } ;
1717use cmp:: { Eq , Equiv } ;
1818use hash:: Hash ;
19- use to_bytes:: IterBytes ;
2019use iter:: BaseIter ;
2120use hash:: Hash ;
2221use iter;
@@ -72,7 +71,7 @@ fn linear_map_with_capacity_and_keys<K:Eq + Hash,V>(
7271 }
7372}
7473
75- priv impl < K : Hash + IterBytes + Eq , V > HashMap < K , V > {
74+ priv impl < K : Hash + Eq , V > HashMap < K , V > {
7675 #[ inline( always) ]
7776 fn to_bucket ( & self , h : uint ) -> uint {
7877 // A good hash function with entropy spread over all of the
@@ -111,9 +110,8 @@ priv impl<K:Hash + IterBytes + Eq,V> HashMap<K, V> {
111110 }
112111
113112 #[ inline( always) ]
114- fn bucket_for_key_equiv < Q : Hash + IterBytes + Equiv < K > > ( & self ,
115- k : & Q )
116- -> SearchResult {
113+ fn bucket_for_key_equiv < Q : Hash + Equiv < K > > ( & self , k : & Q )
114+ -> SearchResult {
117115 let hash = k. hash_keyed ( self . k0 , self . k1 ) as uint ;
118116 self . bucket_for_key_with_hash_equiv ( hash, k)
119117 }
@@ -303,15 +301,15 @@ priv impl<K:Hash + IterBytes + Eq,V> HashMap<K, V> {
303301 }
304302}
305303
306- impl<K:Hash + IterBytes + Eq,V> Container for HashMap<K, V> {
304+ impl<K:Hash + Eq,V> Container for HashMap<K, V> {
307305 /// Return the number of elements in the map
308306 fn len(&const self) -> uint { self.size }
309307
310308 /// Return true if the map contains no elements
311309 fn is_empty(&const self) -> bool { self.len() == 0 }
312310}
313311
314- impl<K:Hash + IterBytes + Eq,V> Mutable for HashMap<K, V> {
312+ impl<K:Hash + Eq,V> Mutable for HashMap<K, V> {
315313 /// Clear the map, removing all key-value pairs.
316314 fn clear(&mut self) {
317315 for uint::range(0, self.buckets.len()) |idx| {
@@ -321,7 +319,7 @@ impl<K:Hash + IterBytes + Eq,V> Mutable for HashMap<K, V> {
321319 }
322320}
323321
324- impl<K:Hash + IterBytes + Eq,V> Map<K, V> for HashMap<K, V> {
322+ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
325323 /// Return true if the map contains a value for the specified key
326324 fn contains_key(&self, k: &K) -> bool {
327325 match self.bucket_for_key(k) {
@@ -458,7 +456,7 @@ impl<K:Hash + IterBytes + Eq,V> Map<K, V> for HashMap<K, V> {
458456 }
459457}
460458
461- pub impl<K: Hash + IterBytes + Eq, V> HashMap<K, V> {
459+ pub impl<K: Hash + Eq, V> HashMap<K, V> {
462460 /// Create an empty HashMap
463461 fn new() -> HashMap<K, V> {
464462 HashMap::with_capacity(INITIAL_CAPACITY)
@@ -669,8 +667,7 @@ pub impl<K: Hash + IterBytes + Eq, V> HashMap<K, V> {
669667
670668 /// Return true if the map contains a value for the specified key,
671669 /// using equivalence
672- fn contains_key_equiv < Q : Hash + IterBytes + Equiv < K > > ( & self , key : & Q )
673- -> bool {
670+ fn contains_key_equiv < Q : Hash + Equiv < K > > ( & self , key : & Q ) -> bool {
674671 match self . bucket_for_key_equiv ( key) {
675672 FoundEntry ( _) => { true }
676673 TableFull | FoundHole ( _) => { false }
@@ -680,8 +677,7 @@ pub impl<K: Hash + IterBytes + Eq, V> HashMap<K, V> {
680677 /// Return the value corresponding to the key in the map, using
681678 /// equivalence
682679 #[ cfg( stage0) ]
683- fn find_equiv < Q : Hash + IterBytes + Equiv < K > > ( & self , k : & Q )
684- -> Option < & ' self V > {
680+ fn find_equiv < Q : Hash + Equiv < K > > ( & self , k : & Q ) -> Option < & ' self V > {
685681 match self . bucket_for_key_equiv ( k) {
686682 FoundEntry ( idx) => Some ( self . value_for_bucket ( idx) ) ,
687683 TableFull | FoundHole ( _) => None ,
@@ -693,17 +689,15 @@ pub impl<K: Hash + IterBytes + Eq, V> HashMap<K, V> {
693689 #[ cfg( stage1) ]
694690 #[ cfg( stage2) ]
695691 #[ cfg( stage3) ]
696- fn find_equiv < ' a , Q : Hash + IterBytes + Equiv < K > > (
697- & ' a self , k : & Q ) -> Option < & ' a V >
698- {
692+ fn find_equiv < ' a , Q : Hash + Equiv < K > > ( & ' a self , k : & Q ) -> Option < & ' a V > {
699693 match self . bucket_for_key_equiv ( k) {
700694 FoundEntry ( idx) => Some ( self . value_for_bucket ( idx) ) ,
701695 TableFull | FoundHole ( _) => None ,
702696 }
703697 }
704698}
705699
706- impl < K : Hash + IterBytes + Eq , V : Eq > Eq for HashMap < K , V > {
700+ impl < K : Hash + Eq , V : Eq > Eq for HashMap < K , V > {
707701 fn eq ( & self , other : & HashMap < K , V > ) -> bool {
708702 if self . len ( ) != other. len ( ) { return false ; }
709703
@@ -724,31 +718,31 @@ pub struct HashSet<T> {
724718 priv map: HashMap < T , ( ) >
725719}
726720
727- impl < T : Hash + IterBytes + Eq > BaseIter < T > for HashSet < T > {
721+ impl < T : Hash + Eq > BaseIter < T > for HashSet < T > {
728722 /// Visit all values in order
729723 fn each ( & self , f : & fn ( & T ) -> bool ) { self . map . each_key ( f) }
730724 fn size_hint ( & self ) -> Option < uint > { Some ( self . len ( ) ) }
731725}
732726
733- impl < T : Hash + IterBytes + Eq > Eq for HashSet < T > {
727+ impl < T : Hash + Eq > Eq for HashSet < T > {
734728 fn eq ( & self , other : & HashSet < T > ) -> bool { self . map == other. map }
735729 fn ne ( & self , other : & HashSet < T > ) -> bool { self . map != other. map }
736730}
737731
738- impl < T : Hash + IterBytes + Eq > Container for HashSet < T > {
732+ impl < T : Hash + Eq > Container for HashSet < T > {
739733 /// Return the number of elements in the set
740734 fn len ( & const self ) -> uint { self . map . len ( ) }
741735
742736 /// Return true if the set contains no elements
743737 fn is_empty ( & const self ) -> bool { self . map . is_empty ( ) }
744738}
745739
746- impl < T : Hash + IterBytes + Eq > Mutable for HashSet < T > {
740+ impl < T : Hash + Eq > Mutable for HashSet < T > {
747741 /// Clear the set, removing all values.
748742 fn clear ( & mut self ) { self . map . clear ( ) }
749743}
750744
751- impl < T : Hash + IterBytes + Eq > Set < T > for HashSet < T > {
745+ impl < T : Hash + Eq > Set < T > for HashSet < T > {
752746 /// Return true if the set contains a value
753747 fn contains ( & self , value : & T ) -> bool { self . map . contains_key ( value) }
754748
@@ -816,7 +810,7 @@ impl<T:Hash + IterBytes + Eq> Set<T> for HashSet<T> {
816810 }
817811}
818812
819- pub impl < T : Hash + IterBytes + Eq > HashSet < T > {
813+ pub impl < T : Hash + Eq > HashSet < T > {
820814 /// Create an empty HashSet
821815 fn new ( ) -> HashSet < T > {
822816 HashSet :: with_capacity ( INITIAL_CAPACITY )
0 commit comments