auto merge of #6236 : alexcrichton/rust/more-map-methods, r=thestinger

Closes #5392 and #5393

I implemented the pop/swap methods for TrieMap/TreeMap/SmallIntMap, and I also updated all of them such that pop isn't just a remove/insert, but rather it's all done in one operation.

One thing I did notice is that with default methods it'd be really nice to define `insert` and `remove` in terms of `pop` and `swap` (or vice versa, just to have them available).
This commit is contained in:
bors 2013-05-06 23:06:36 -07:00
commit 3225870191
6 changed files with 188 additions and 84 deletions

View file

@ -103,6 +103,10 @@ impl<T> Map<int, T> for cat<T> {
false
}
}
fn pop(&mut self, _k: &int) -> Option<T> { fail!() }
fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail!() }
}
pub impl<T> cat<T> {