summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/smallintmap.rs20
-rw-r--r--src/libstd/treemap.rs6
2 files changed, 13 insertions, 13 deletions
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs
index 9af596eb1f5..218964695e2 100644
--- a/src/libstd/smallintmap.rs
+++ b/src/libstd/smallintmap.rs
@@ -48,16 +48,6 @@ impl<V> SmallIntMap<V>: Map<uint, V> {
         self.find(key).is_some()
     }
 
-    /// Visit all key-value pairs
-    pure fn each(&self, it: fn(key: &uint, value: &V) -> bool) {
-        for uint::range(0, self.v.len()) |i| {
-            match self.v[i] {
-              Some(ref elt) => if !it(&i, elt) { break },
-              None => ()
-            }
-        }
-    }
-
     /// Visit all keys
     pure fn each_key(&self, blk: fn(key: &uint) -> bool) {
         self.each(|k, _| blk(k))
@@ -109,6 +99,16 @@ pub impl<V> SmallIntMap<V> {
     /// Create an empty SmallIntMap
     static pure fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} }
 
+    /// Visit all key-value pairs
+    pure fn each(&self, it: fn(key: &uint, value: &V) -> bool) {
+        for uint::range(0, self.v.len()) |i| {
+            match self.v[i] {
+              Some(ref elt) => if !it(&i, elt) { break },
+              None => ()
+            }
+        }
+    }
+
     pure fn get(&self, key: &uint) -> &self/V {
         self.find(key).expect("key not present")
     }
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index 1e90abcc03d..70226c7277d 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -125,9 +125,6 @@ impl <K: Ord, V> TreeMap<K, V>: Map<K, V> {
         self.find(key).is_some()
     }
 
-    /// Visit all key-value pairs in order
-    pure fn each(&self, f: fn(&K, &V) -> bool) { each(&self.root, f) }
-
     /// Visit all keys in order
     pure fn each_key(&self, f: fn(&K) -> bool) { self.each(|k, _| f(k)) }
 
@@ -175,6 +172,9 @@ impl <K: Ord, V> TreeMap<K, V> {
     /// Create an empty TreeMap
     static pure fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
 
+    /// Visit all key-value pairs in order
+    pure fn each(&self, f: fn(&K, &V) -> bool) { each(&self.root, f) }
+
     /// Visit all key-value pairs in reverse order
     pure fn each_reverse(&self, f: fn(&K, &V) -> bool) {
         each_reverse(&self.root, f);