extra::treemap: remove mutate_values, replaced by .mut_iter().

This commit is contained in:
Huon Wilson 2014-01-06 00:42:01 +11:00
parent 463a6d9064
commit e33fcf9da9
1 changed files with 0 additions and 23 deletions

View File

@ -135,11 +135,6 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
/// Create an empty TreeMap
pub fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
/// Iterate over the map and mutate the contained values
pub fn mutate_values(&mut self, f: |&K, &mut V| -> bool) -> bool {
mutate_values(&mut self.root, f)
}
/// Get a lazy iterator over the key-value pairs in the map.
/// Requires that it be frozen (immutable).
pub fn iter<'a>(&'a self) -> TreeMapIterator<'a, K, V> {
@ -892,24 +887,6 @@ impl<K: TotalOrd, V> TreeNode<K, V> {
}
}
fn mutate_values<'r,
K:TotalOrd,
V>(
node: &'r mut Option<~TreeNode<K,V>>,
f: |&'r K, &'r mut V| -> bool)
-> bool {
match *node {
Some(~TreeNode{key: ref key, value: ref mut value, left: ref mut left,
right: ref mut right, ..}) => {
if !mutate_values(left, |k,v| f(k,v)) { return false }
if !f(key, value) { return false }
if !mutate_values(right, |k,v| f(k,v)) { return false }
}
None => return false
}
true
}
// Remove left horizontal link by rotating right
fn skew<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
if node.left.as_ref().map_default(false, |x| x.level == node.level) {