summary refs log tree commit diff
path: root/src/libstd/smallintmap.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-11-25 12:45:18 -0800
committerBrian Anderson <banderson@mozilla.com>2012-11-25 13:26:37 -0800
commit5c0206a1e4e5049a4a5d35ea6fee10cbd3f45aa0 (patch)
treecb3ab8eb672fab2de50e58dd640e7df8e087b347 /src/libstd/smallintmap.rs
parentff4075e553ccc5be73c05332f15ef46f761b0817 (diff)
downloadrust-5c0206a1e4e5049a4a5d35ea6fee10cbd3f45aa0.tar.gz
rust-5c0206a1e4e5049a4a5d35ea6fee10cbd3f45aa0.zip
Rename insert_with functions to update, update_with_key
Diffstat (limited to 'src/libstd/smallintmap.rs')
-rw-r--r--src/libstd/smallintmap.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs
index 2fdfa3deea8..3f9d308584d 100644
--- a/src/libstd/smallintmap.rs
+++ b/src/libstd/smallintmap.rs
@@ -103,15 +103,15 @@ impl<V: Copy> SmallIntMap<V>: map::Map<uint, V> {
     pure fn find(key: uint) -> Option<V> { find(self, key) }
     fn rehash() { fail }
 
-    fn insert_with_key(key: uint, val: V, ff: fn(uint, V, V) -> V) -> bool {
+    fn update_with_key(key: uint, val: V, ff: fn(uint, V, V) -> V) -> bool {
         match self.find(key) {
             None            => return self.insert(key, val),
             Some(copy orig) => return self.insert(key, ff(key, orig, val)),
         }
     }
 
-    fn insert_with(key: uint, newval: V, ff: fn(V, V) -> V) -> bool {
-        return self.insert_with_key(key, newval, |_k, v, v1| ff(v,v1));
+    fn update(key: uint, newval: V, ff: fn(V, V) -> V) -> bool {
+        return self.update_with_key(key, newval, |_k, v, v1| ff(v,v1));
     }
 
     pure fn each(it: fn(key: uint, value: V) -> bool) {
@@ -172,11 +172,11 @@ mod tests {
         }
 
         // count integers
-        map.insert_with(3, 1, addMoreToCount_simple);
-        map.insert_with_key(9, 1, addMoreToCount);
-        map.insert_with(3, 7, addMoreToCount_simple);
-        map.insert_with_key(5, 3, addMoreToCount);
-        map.insert_with_key(3, 2, addMoreToCount);
+        map.update(3, 1, addMoreToCount_simple);
+        map.update_with_key(9, 1, addMoreToCount);
+        map.update(3, 7, addMoreToCount_simple);
+        map.update_with_key(5, 3, addMoreToCount);
+        map.update_with_key(3, 2, addMoreToCount);
 
         // check the total counts
         assert 10 == option::get(map.find(3));