about summary refs log tree commit diff
path: root/src/libstd/treemap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/treemap.rs')
-rw-r--r--src/libstd/treemap.rs66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index e4279a57ad5..eb3093a2745 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -39,7 +39,7 @@ pub struct TreeMap<K, V> {
     priv length: uint
 }
 
-impl<K: Eq Ord, V: Eq> Eq for TreeMap<K, V> {
+impl<K:Eq + Ord,V:Eq> Eq for TreeMap<K, V> {
     pure fn eq(&self, other: &TreeMap<K, V>) -> bool {
         if self.len() != other.len() {
             false
@@ -66,7 +66,7 @@ impl<K: Eq Ord, V: Eq> Eq for TreeMap<K, V> {
 }
 
 // Lexicographical comparison
-pure fn lt<K: Ord, V>(a: &TreeMap<K, V>, b: &TreeMap<K, V>) -> bool {
+pure fn lt<K:Ord,V>(a: &TreeMap<K, V>, b: &TreeMap<K, V>) -> bool {
     let mut x = a.iter();
     let mut y = b.iter();
 
@@ -85,7 +85,7 @@ pure fn lt<K: Ord, V>(a: &TreeMap<K, V>, b: &TreeMap<K, V>) -> bool {
     return a_len < b_len;
 }
 
-impl<K: Ord, V> Ord for TreeMap<K, V> {
+impl<K:Ord,V> Ord for TreeMap<K, V> {
     #[inline(always)]
     pure fn lt(&self, other: &TreeMap<K, V>) -> bool {
         lt(self, other)
@@ -104,7 +104,7 @@ impl<K: Ord, V> Ord for TreeMap<K, V> {
     }
 }
 
-impl<K: Ord, V> BaseIter<(&K, &V)> for TreeMap<K, V> {
+impl<K:Ord,V> BaseIter<(&K, &V)> for TreeMap<K, V> {
     /// Visit all key-value pairs in order
     pure fn each(&self, f: fn(&(&self/K, &self/V)) -> bool) {
         each(&self.root, f)
@@ -112,14 +112,14 @@ impl<K: Ord, V> BaseIter<(&K, &V)> for TreeMap<K, V> {
     pure fn size_hint(&self) -> Option<uint> { Some(self.len()) }
 }
 
-impl<K: Ord, V> ReverseIter<(&K, &V)> for TreeMap<K, V> {
+impl<K:Ord,V> ReverseIter<(&K, &V)> for TreeMap<K, V> {
     /// Visit all key-value pairs in reverse order
     pure fn each_reverse(&self, f: fn(&(&self/K, &self/V)) -> bool) {
         each_reverse(&self.root, f);
     }
 }
 
-impl<K: Ord, V> Container for TreeMap<K, V> {
+impl<K:Ord,V> Container for TreeMap<K, V> {
     /// Return the number of elements in the map
     pure fn len(&self) -> uint { self.length }
 
@@ -127,7 +127,7 @@ impl<K: Ord, V> Container for TreeMap<K, V> {
     pure fn is_empty(&self) -> bool { self.root.is_none() }
 }
 
-impl<K: Ord, V> Mutable for TreeMap<K, V> {
+impl<K:Ord,V> Mutable for TreeMap<K, V> {
     /// Clear the map, removing all key-value pairs.
     fn clear(&mut self) {
         self.root = None;
@@ -135,7 +135,7 @@ impl<K: Ord, V> Mutable for TreeMap<K, V> {
     }
 }
 
-impl<K: Ord, V> Map<K, V> for TreeMap<K, V> {
+impl<K:Ord,V> Map<K, V> for TreeMap<K, V> {
     /// Return true if the map contains a value for the specified key
     pure fn contains_key(&self, key: &K) -> bool {
         self.find(key).is_some()
@@ -184,7 +184,7 @@ impl<K: Ord, V> Map<K, V> for TreeMap<K, V> {
     }
 }
 
-impl <K: Ord, V> TreeMap<K, V> {
+impl <K:Ord,V> TreeMap<K, V> {
     /// Create an empty TreeMap
     static pure fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
 
@@ -212,7 +212,7 @@ pub struct TreeMapIterator<K, V> {
     priv current: Option<&~TreeNode<K, V>>
 }
 
-impl <K: Ord, V> TreeMapIterator<K, V> {
+impl <K:Ord,V> TreeMapIterator<K, V> {
     // Returns the current node, or None if this iterator is at the end.
     fn get(&const self) -> Option<(&self/K, &self/V)> {
         match self.current {
@@ -224,7 +224,7 @@ impl <K: Ord, V> TreeMapIterator<K, V> {
 
 /// Advance the iterator to the next node (in order). If this iterator
 /// is finished, does nothing.
-pub fn map_next<K: Ord, V>(iter: &mut TreeMapIterator/&a<K, V>) {
+pub fn map_next<K:Ord,V>(iter: &mut TreeMapIterator/&a<K, V>) {
     while !iter.stack.is_empty() || iter.node.is_some() {
         match *iter.node {
           Some(ref x) => {
@@ -246,25 +246,25 @@ pub struct TreeSet<T> {
     priv map: TreeMap<T, ()>
 }
 
-impl<T: Ord> BaseIter<T> for TreeSet<T> {
+impl<T:Ord> BaseIter<T> for TreeSet<T> {
     /// Visit all values in order
     pure fn each(&self, f: fn(&T) -> bool) { self.map.each_key(f) }
     pure fn size_hint(&self) -> Option<uint> { Some(self.len()) }
 }
 
-impl<T: Ord> ReverseIter<T> for TreeSet<T> {
+impl<T:Ord> ReverseIter<T> for TreeSet<T> {
     /// Visit all values in reverse order
     pure fn each_reverse(&self, f: fn(&T) -> bool) {
         self.map.each_key_reverse(f)
     }
 }
 
-impl<T: Eq Ord> Eq for TreeSet<T> {
+impl<T:Eq + Ord> Eq for TreeSet<T> {
     pure fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
     pure fn ne(&self, other: &TreeSet<T>) -> bool { self.map != other.map }
 }
 
-impl<T: Ord> Ord for TreeSet<T> {
+impl<T:Ord> Ord for TreeSet<T> {
     #[inline(always)]
     pure fn lt(&self, other: &TreeSet<T>) -> bool { self.map < other.map }
     #[inline(always)]
@@ -275,7 +275,7 @@ impl<T: Ord> Ord for TreeSet<T> {
     pure fn gt(&self, other: &TreeSet<T>) -> bool { self.map > other.map }
 }
 
-impl<T: Ord> Container for TreeSet<T> {
+impl<T:Ord> Container for TreeSet<T> {
     /// Return the number of elements in the set
     pure fn len(&self) -> uint { self.map.len() }
 
@@ -283,12 +283,12 @@ impl<T: Ord> Container for TreeSet<T> {
     pure fn is_empty(&self) -> bool { self.map.is_empty() }
 }
 
-impl<T: Ord> Mutable for TreeSet<T> {
+impl<T:Ord> Mutable for TreeSet<T> {
     /// Clear the set, removing all values.
     fn clear(&mut self) { self.map.clear() }
 }
 
-impl<T: Ord> Set<T> for TreeSet<T> {
+impl<T:Ord> Set<T> for TreeSet<T> {
     /// Return true if the set contains a value
     pure fn contains(&self, value: &T) -> bool {
         self.map.contains_key(value)
@@ -510,7 +510,7 @@ impl<T: Ord> Set<T> for TreeSet<T> {
     }
 }
 
-impl <T: Ord> TreeSet<T> {
+impl <T:Ord> TreeSet<T> {
     /// Create an empty TreeSet
     static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
 
@@ -526,7 +526,7 @@ pub struct TreeSetIterator<T> {
     priv iter: TreeMapIterator<T, ()>
 }
 
-impl <T: Ord> TreeSetIterator<T> {
+impl <T:Ord> TreeSetIterator<T> {
     /// Returns the current node, or None if this iterator is at the end.
     fn get(&const self) -> Option<&self/T> {
         match self.iter.get() {
@@ -538,7 +538,7 @@ impl <T: Ord> TreeSetIterator<T> {
 
 /// Advance the iterator to the next node (in order). If this iterator is
 /// finished, does nothing.
-pub fn set_next<T: Ord>(iter: &mut TreeSetIterator/&a<T>) {
+pub fn set_next<T:Ord>(iter: &mut TreeSetIterator/&a<T>) {
     map_next(&mut iter.iter);
 }
 
@@ -552,14 +552,14 @@ struct TreeNode<K, V> {
     level: uint
 }
 
-impl <K: Ord, V> TreeNode<K, V> {
+impl <K:Ord,V> TreeNode<K, V> {
     #[inline(always)]
     static pure fn new(key: K, value: V) -> TreeNode<K, V> {
         TreeNode{key: key, value: value, left: None, right: None, level: 1}
     }
 }
 
-pure fn each<K: Ord, V>(node: &r/Option<~TreeNode<K, V>>,
+pure fn each<K:Ord,V>(node: &r/Option<~TreeNode<K, V>>,
                         f: fn(&(&r/K, &r/V)) -> bool) {
     do node.iter |x| {
         each(&x.left, f);
@@ -567,7 +567,7 @@ pure fn each<K: Ord, V>(node: &r/Option<~TreeNode<K, V>>,
     }
 }
 
-pure fn each_reverse<K: Ord, V>(node: &r/Option<~TreeNode<K, V>>,
+pure fn each_reverse<K:Ord,V>(node: &r/Option<~TreeNode<K, V>>,
                                 f: fn(&(&r/K, &r/V)) -> bool) {
     do node.iter |x| {
         each_reverse(&x.right, f);
@@ -576,7 +576,7 @@ pure fn each_reverse<K: Ord, V>(node: &r/Option<~TreeNode<K, V>>,
 }
 
 // Remove left horizontal link by rotating right
-fn skew<K: Ord, V>(node: &mut ~TreeNode<K, V>) {
+fn skew<K:Ord,V>(node: &mut ~TreeNode<K, V>) {
     if node.left.map_default(false, |x| x.level == node.level) {
         let mut save = node.left.swap_unwrap();
         node.left <-> save.right; // save.right now None
@@ -587,7 +587,7 @@ fn skew<K: Ord, V>(node: &mut ~TreeNode<K, V>) {
 
 // Remove dual horizontal link by rotating left and increasing level of
 // the parent
-fn split<K: Ord, V>(node: &mut ~TreeNode<K, V>) {
+fn split<K:Ord,V>(node: &mut ~TreeNode<K, V>) {
     if node.right.map_default(false,
       |x| x.right.map_default(false, |y| y.level == node.level)) {
         let mut save = node.right.swap_unwrap();
@@ -598,7 +598,7 @@ fn split<K: Ord, V>(node: &mut ~TreeNode<K, V>) {
     }
 }
 
-fn insert<K: Ord, V>(node: &mut Option<~TreeNode<K, V>>, key: K,
+fn insert<K:Ord,V>(node: &mut Option<~TreeNode<K, V>>, key: K,
                      value: V) -> bool {
     match *node {
       Some(ref mut save) => {
@@ -625,8 +625,8 @@ fn insert<K: Ord, V>(node: &mut Option<~TreeNode<K, V>>, key: K,
     }
 }
 
-fn remove<K: Ord, V>(node: &mut Option<~TreeNode<K, V>>, key: &K) -> bool {
-    fn heir_swap<K: Ord, V>(node: &mut ~TreeNode<K, V>,
+fn remove<K:Ord,V>(node: &mut Option<~TreeNode<K, V>>, key: &K) -> bool {
+    fn heir_swap<K:Ord,V>(node: &mut ~TreeNode<K, V>,
                             child: &mut Option<~TreeNode<K, V>>) {
         // *could* be done without recursion, but it won't borrow check
         do child.mutate |mut child| {
@@ -772,7 +772,7 @@ mod test_treemap {
         assert m.find(&k1) == Some(&v1);
     }
 
-    fn check_equal<K: Eq Ord, V: Eq>(ctrl: &[(K, V)], map: &TreeMap<K, V>) {
+    fn check_equal<K:Eq + Ord,V:Eq>(ctrl: &[(K, V)], map: &TreeMap<K, V>) {
         assert ctrl.is_empty() == map.is_empty();
         for ctrl.each |x| {
             let &(k, v) = x;
@@ -792,7 +792,7 @@ mod test_treemap {
         }
     }
 
-    fn check_left<K: Ord, V>(node: &Option<~TreeNode<K, V>>,
+    fn check_left<K:Ord,V>(node: &Option<~TreeNode<K, V>>,
                              parent: &~TreeNode<K, V>) {
         match *node {
           Some(ref r) => {
@@ -805,7 +805,7 @@ mod test_treemap {
         }
     }
 
-    fn check_right<K: Ord, V>(node: &Option<~TreeNode<K, V>>,
+    fn check_right<K:Ord,V>(node: &Option<~TreeNode<K, V>>,
                               parent: &~TreeNode<K, V>, parent_red: bool) {
         match *node {
           Some(ref r) => {
@@ -820,7 +820,7 @@ mod test_treemap {
         }
     }
 
-    fn check_structure<K: Ord, V>(map: &TreeMap<K, V>) {
+    fn check_structure<K:Ord,V>(map: &TreeMap<K, V>) {
         match map.root {
           Some(ref r) => {
             check_left(&r.left, r);