about summary refs log tree commit diff
path: root/src/libcore/send_map.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-09-18 21:41:37 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-09-19 10:52:59 -0700
commit9cf271fe96b474d514b1052935db70c4056cf076 (patch)
tree7a6fb31efeaa4de91317c16aca824153aaaf988c /src/libcore/send_map.rs
parent62b7f4d800325b46002c47d23b58a9f2b7fabb9b (diff)
downloadrust-9cf271fe96b474d514b1052935db70c4056cf076.tar.gz
rust-9cf271fe96b474d514b1052935db70c4056cf076.zip
De-mode vec::each() and many of the str iteration routines
Note that the method foo.each() is not de-moded, nor the other
vec routines.
Diffstat (limited to 'src/libcore/send_map.rs')
-rw-r--r--src/libcore/send_map.rs32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs
index 28b36deb1d4..5dfc1f64367 100644
--- a/src/libcore/send_map.rs
+++ b/src/libcore/send_map.rs
@@ -17,7 +17,7 @@ trait SendMap<K:Eq Hash, V: Copy> {
     pure fn len(&const self) -> uint;
     pure fn is_empty(&const self) -> bool;
     pure fn contains_key(&const self, k: &K) -> bool;
-    pure fn each_ref(&self, blk: fn(k: &K, v: &V) -> bool);
+    pure fn each(&self, blk: fn(k: &K, v: &V) -> bool);
     pure fn each_key_ref(&self, blk: fn(k: &K) -> bool);
     pure fn each_value_ref(&self, blk: fn(v: &V) -> bool);
     pure fn find(&const self, k: &K) -> Option<V>;
@@ -311,7 +311,7 @@ mod linear {
             }
         }
 
-        pure fn each_ref(&self, blk: fn(k: &K, v: &V) -> bool) {
+        pure fn each(&self, blk: fn(k: &K, v: &V) -> bool) {
             for vec::each(self.buckets) |slot| {
                 let mut broke = false;
                 do slot.iter |bucket| {
@@ -323,12 +323,12 @@ mod linear {
             }
         }
 
-        pure fn each_key_ref(&self, blk: fn(k: &K) -> bool) {
-            self.each_ref(|k, _v| blk(k))
+        pure fn each_key(&self, blk: fn(k: &K) -> bool) {
+            self.each(|k, _v| blk(k))
         }
 
-        pure fn each_value_ref(&self, blk: fn(v: &V) -> bool) {
-            self.each_ref(|_k, v| blk(v))
+        pure fn each_value(&self, blk: fn(v: &V) -> bool) {
+            self.each(|_k, v| blk(v))
         }
     }
 
@@ -358,22 +358,6 @@ mod linear {
         }
 
     }
-
-    impl<K: Hash IterBytes Eq Copy, V: Copy> LinearMap<K,V> {
-        pure fn each(&self, blk: fn(+K,+V) -> bool) {
-            self.each_ref(|k,v| blk(copy *k, copy *v));
-        }
-    }
-    impl<K: Hash IterBytes Eq Copy, V> LinearMap<K,V> {
-        pure fn each_key(&self, blk: fn(+K) -> bool) {
-            self.each_key_ref(|k| blk(copy *k));
-        }
-    }
-    impl<K: Hash IterBytes Eq, V: Copy> LinearMap<K,V> {
-        pure fn each_value(&self, blk: fn(+V) -> bool) {
-            self.each_value_ref(|v| blk(copy *v));
-        }
-    }
 }
 
 #[test]
@@ -438,8 +422,8 @@ mod test {
         }
         let mut observed = 0;
         for m.each |k, v| {
-            assert v == k*2;
-            observed |= (1 << k);
+            assert *v == *k * 2;
+            observed |= (1 << *k);
         }
         assert observed == 0xFFFF_FFFF;
     }