Register snapshots

This commit is contained in:
Brian Anderson 2013-05-19 19:46:54 -07:00
parent 3a481c0f88
commit 66319b0278
74 changed files with 23 additions and 9843 deletions

View file

@ -51,18 +51,6 @@ impl<V> Map<uint, V> for SmallIntMap<V> {
}
/// Visit all key-value pairs in order
#[cfg(stage0)]
fn each<'a>(&'a self, it: &fn(&uint, &'a 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 key-value pairs in order
#[cfg(not(stage0))]
fn each<'a>(&'a self, it: &fn(&uint, &'a V) -> bool) -> bool {
for uint::range(0, self.v.len()) |i| {
match self.v[i] {
@ -73,41 +61,17 @@ impl<V> Map<uint, V> for SmallIntMap<V> {
return true;
}
/// Visit all keys in order
#[cfg(stage0)]
fn each_key(&self, blk: &fn(key: &uint) -> bool) {
self.each(|k, _| blk(k))
}
#[cfg(not(stage0))]
/// Visit all keys in order
fn each_key(&self, blk: &fn(key: &uint) -> bool) -> bool {
self.each(|k, _| blk(k))
}
/// Visit all values in order
#[cfg(stage0)]
fn each_value<'a>(&'a self, blk: &fn(value: &'a V) -> bool) {
self.each(|_, v| blk(v))
}
/// Visit all values in order
#[cfg(not(stage0))]
fn each_value<'a>(&'a self, blk: &fn(value: &'a V) -> bool) -> bool {
self.each(|_, v| blk(v))
}
/// Iterate over the map and mutate the contained values
#[cfg(stage0)]
fn mutate_values(&mut self, it: &fn(&uint, &mut V) -> bool) {
for uint::range(0, self.v.len()) |i| {
match self.v[i] {
Some(ref mut elt) => if !it(&i, elt) { return; },
None => ()
}
}
}
/// Iterate over the map and mutate the contained values
#[cfg(not(stage0))]
fn mutate_values(&mut self, it: &fn(&uint, &mut V) -> bool) -> bool {
for uint::range(0, self.v.len()) |i| {
match self.v[i] {
@ -187,18 +151,6 @@ pub impl<V> SmallIntMap<V> {
fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} }
/// Visit all key-value pairs in reverse order
#[cfg(stage0)]
fn each_reverse<'a>(&'a self, it: &fn(uint, &'a V) -> bool) {
for uint::range_rev(self.v.len(), 0) |i| {
match self.v[i - 1] {
Some(ref elt) => if !it(i - 1, elt) { break },
None => ()
}
}
}
/// Visit all key-value pairs in reverse order
#[cfg(not(stage0))]
fn each_reverse<'a>(&'a self, it: &fn(uint, &'a V) -> bool) -> bool {
for uint::range_rev(self.v.len(), 0) |i| {
match self.v[i - 1] {