@@ -56,14 +56,14 @@ pub mod linear {
56
56
( ( capacity as float ) * 3. / 4. ) as uint
57
57
}
58
58
59
- pub fn linear_map_with_capacity < K : Eq Hash , V > (
59
+ pub fn linear_map_with_capacity < K : Eq + Hash , V > (
60
60
initial_capacity : uint ) -> LinearMap < K , V > {
61
61
let r = rand:: task_rng ( ) ;
62
62
linear_map_with_capacity_and_keys ( r. gen_u64 ( ) , r. gen_u64 ( ) ,
63
63
initial_capacity)
64
64
}
65
65
66
- pure fn linear_map_with_capacity_and_keys < K : Eq Hash , V > (
66
+ pure fn linear_map_with_capacity_and_keys < K : Eq + Hash , V > (
67
67
k0 : u64 , k1 : u64 ,
68
68
initial_capacity : uint ) -> LinearMap < K , V > {
69
69
LinearMap {
@@ -74,7 +74,7 @@ pub mod linear {
74
74
}
75
75
}
76
76
77
- priv impl < K : Hash IterBytes Eq , V > LinearMap < K , V > {
77
+ priv impl < K : Hash + IterBytes + Eq , V > LinearMap < K , V > {
78
78
#[ inline( always) ]
79
79
pure fn to_bucket ( & self , h : uint ) -> uint {
80
80
// A good hash function with entropy spread over all of the
@@ -246,7 +246,7 @@ pub mod linear {
246
246
}
247
247
}
248
248
249
- impl<K: Hash IterBytes Eq, V> BaseIter<(&K, &V)> for LinearMap<K, V> {
249
+ impl<K:Hash + IterBytes + Eq,V> BaseIter<(&K, &V)> for LinearMap<K, V> {
250
250
/// Visit all key-value pairs
251
251
pure fn each(&self, blk: fn(&(&self/K, &self/V)) -> bool) {
252
252
for uint::range(0, self.buckets.len()) |i| {
@@ -263,15 +263,15 @@ pub mod linear {
263
263
}
264
264
265
265
266
- impl<K: Hash IterBytes Eq, V> Container for LinearMap<K, V> {
266
+ impl<K:Hash + IterBytes + Eq,V> Container for LinearMap<K, V> {
267
267
/// Return the number of elements in the map
268
268
pure fn len(&self) -> uint { self.size }
269
269
270
270
/// Return true if the map contains no elements
271
271
pure fn is_empty(&self) -> bool { self.len() == 0 }
272
272
}
273
273
274
- impl<K: Hash IterBytes Eq, V> Mutable for LinearMap<K, V> {
274
+ impl<K:Hash + IterBytes + Eq,V> Mutable for LinearMap<K, V> {
275
275
/// Clear the map, removing all key-value pairs.
276
276
fn clear(&mut self) {
277
277
for uint::range(0, self.buckets.len()) |idx| {
@@ -281,7 +281,7 @@ pub mod linear {
281
281
}
282
282
}
283
283
284
- impl<K: Hash IterBytes Eq, V> Map<K, V> for LinearMap<K, V> {
284
+ impl<K:Hash + IterBytes + Eq,V> Map<K, V> for LinearMap<K, V> {
285
285
/// Return true if the map contains a value for the specified key
286
286
pure fn contains_key(&self, k: &K) -> bool {
287
287
match self.bucket_for_key(k) {
@@ -333,7 +333,7 @@ pub mod linear {
333
333
}
334
334
}
335
335
336
- pub impl<K:Hash IterBytes Eq, V> LinearMap<K, V> {
336
+ pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
337
337
/// Create an empty LinearMap
338
338
static fn new() -> LinearMap<K, V> {
339
339
linear_map_with_capacity(INITIAL_CAPACITY)
@@ -457,7 +457,7 @@ pub mod linear {
457
457
}
458
458
}
459
459
460
- impl < K : Hash IterBytes Eq , V : Eq > Eq for LinearMap < K , V > {
460
+ impl < K : Hash + IterBytes + Eq , V : Eq > Eq for LinearMap < K , V > {
461
461
pure fn eq ( & self , other : & LinearMap < K , V > ) -> bool {
462
462
if self . len ( ) != other. len ( ) { return false ; }
463
463
@@ -478,13 +478,13 @@ pub mod linear {
478
478
priv map: LinearMap < T , ( ) >
479
479
}
480
480
481
- impl < T : Hash IterBytes Eq > BaseIter < T > for LinearSet < T > {
481
+ impl < T : Hash + IterBytes + Eq > BaseIter < T > for LinearSet < T > {
482
482
/// Visit all values in order
483
483
pure fn each ( & self , f : fn ( & T ) -> bool ) { self . map . each_key ( f) }
484
484
pure fn size_hint ( & self ) -> Option < uint > { Some ( self . len ( ) ) }
485
485
}
486
486
487
- impl < T : Hash IterBytes Eq > Eq for LinearSet < T > {
487
+ impl < T : Hash + IterBytes + Eq > Eq for LinearSet < T > {
488
488
pure fn eq ( & self , other : & LinearSet < T > ) -> bool {
489
489
self . map == other. map
490
490
}
@@ -493,20 +493,20 @@ pub mod linear {
493
493
}
494
494
}
495
495
496
- impl < T : Hash IterBytes Eq > Container for LinearSet < T > {
496
+ impl < T : Hash + IterBytes + Eq > Container for LinearSet < T > {
497
497
/// Return the number of elements in the set
498
498
pure fn len ( & self ) -> uint { self . map . len ( ) }
499
499
500
500
/// Return true if the set contains no elements
501
501
pure fn is_empty ( & self ) -> bool { self . map . is_empty ( ) }
502
502
}
503
503
504
- impl < T : Hash IterBytes Eq > Mutable for LinearSet < T > {
504
+ impl < T : Hash + IterBytes + Eq > Mutable for LinearSet < T > {
505
505
/// Clear the set, removing all values.
506
506
fn clear ( & mut self ) { self . map . clear ( ) }
507
507
}
508
508
509
- impl < T : Hash IterBytes Eq > Set < T > for LinearSet < T > {
509
+ impl < T : Hash + IterBytes + Eq > Set < T > for LinearSet < T > {
510
510
/// Return true if the set contains a value
511
511
pure fn contains ( & self , value : & T ) -> bool {
512
512
self . map . contains_key ( value)
@@ -575,7 +575,7 @@ pub mod linear {
575
575
}
576
576
}
577
577
578
- pub impl < T : Hash IterBytes Eq > LinearSet < T > {
578
+ pub impl < T : Hash + IterBytes + Eq > LinearSet < T > {
579
579
/// Create an empty LinearSet
580
580
static fn new( ) -> LinearSet <T > { LinearSet { map: LinearMap :: new( ) } }
581
581
0 commit comments