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.
This commit is contained in:
Niko Matsakis
2012-09-18 21:41:37 -07:00
parent 62b7f4d800
commit 9cf271fe96
81 changed files with 556 additions and 750 deletions

View File

@@ -103,21 +103,15 @@ impl<V: Copy> SmallIntMap<V>: map::Map<uint, V> {
fn get(+key: uint) -> V { get(self, key) }
pure fn find(+key: uint) -> Option<V> { find(self, key) }
fn rehash() { fail }
pure fn each(it: fn(+key: uint, +value: V) -> bool) {
let mut idx = 0u, l = self.v.len();
while idx < l {
match self.v.get_elt(idx) {
Some(elt) => if !it(idx, elt) { break },
None => ()
}
idx += 1u;
}
self.each_ref(|k, v| it(*k, *v))
}
pure fn each_key(it: fn(+key: uint) -> bool) {
self.each(|k, _v| it(k))
self.each_ref(|k, _v| it(*k))
}
pure fn each_value(it: fn(+value: V) -> bool) {
self.each(|_k, v| it(v))
self.each_ref(|_k, v| it(*v))
}
pure fn each_ref(it: fn(key: &uint, value: &V) -> bool) {
let mut idx = 0u, l = self.v.len();