diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-02-07 17:49:57 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-02-07 22:04:35 -0500 |
| commit | 83270d2d792fb519481f6df87f23d73c767ec5f9 (patch) | |
| tree | 89b8242df68a8a249291c6a2b5354bc7de2f0bac /src/libstd/smallintmap.rs | |
| parent | d903231f1e7d7efb35405bdfdcbc451385e429b2 (diff) | |
| download | rust-83270d2d792fb519481f6df87f23d73c767ec5f9.tar.gz rust-83270d2d792fb519481f6df87f23d73c767ec5f9.zip | |
rm each method from the Map trait
the map types should implement BaseIter instead
Diffstat (limited to 'src/libstd/smallintmap.rs')
| -rw-r--r-- | src/libstd/smallintmap.rs | 20 |
1 files changed, 10 insertions, 10 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") } |
