@@ -226,10 +226,10 @@ impl<K: Ord, V> Map<K, V> for TreeMap<K, V> {
226226}
227227
228228impl < K : Ord , V > MutableMap < K , V > for TreeMap < K , V > {
229- // See comments on def_tree_find_mut_with
229+ // See comments on tree_find_with_mut
230230 #[ inline]
231231 fn find_mut < ' a > ( & ' a mut self , key : & K ) -> Option < & ' a mut V > {
232- tree_find_mut_with ( & mut self . root , |x| key. cmp ( x) )
232+ tree_find_with_mut ( & mut self . root , |x| key. cmp ( x) )
233233 }
234234
235235 fn swap ( & mut self , key : K , value : V ) -> Option < V > {
@@ -361,6 +361,12 @@ impl<K: Ord, V> TreeMap<K, V> {
361361 RevEntries { iter : self . iter ( ) }
362362 }
363363
364+ /// Deprecated: use `iter_mut`.
365+ #[ deprecated = "use iter_mut" ]
366+ pub fn mut_iter < ' a > ( & ' a mut self ) -> MutEntries < ' a , K , V > {
367+ self . iter_mut ( )
368+ }
369+
364370 /// Gets a lazy forward iterator over the key-value pairs in the
365371 /// map, with the values being mutable.
366372 ///
@@ -383,15 +389,21 @@ impl<K: Ord, V> TreeMap<K, V> {
383389 /// assert_eq!(map.find(&"b"), Some(&12));
384390 /// assert_eq!(map.find(&"c"), Some(&3));
385391 /// ```
386- pub fn mut_iter < ' a > ( & ' a mut self ) -> MutEntries < ' a , K , V > {
392+ pub fn iter_mut < ' a > ( & ' a mut self ) -> MutEntries < ' a , K , V > {
387393 MutEntries {
388394 stack : vec ! ( ) ,
389- node : mut_deref ( & mut self . root ) ,
395+ node : deref_mut ( & mut self . root ) ,
390396 remaining_min : self . length ,
391397 remaining_max : self . length
392398 }
393399 }
394400
401+ /// Deprecated: use `rev_iter_mut`.
402+ #[ deprecated = "use rev_iter_mut" ]
403+ pub fn mut_rev_iter < ' a > ( & ' a mut self ) -> RevMutEntries < ' a , K , V > {
404+ self . rev_iter_mut ( )
405+ }
406+
395407 /// Gets a lazy reverse iterator over the key-value pairs in the
396408 /// map, with the values being mutable.
397409 ///
@@ -414,10 +426,15 @@ impl<K: Ord, V> TreeMap<K, V> {
414426 /// assert_eq!(map.find(&"b"), Some(&12));
415427 /// assert_eq!(map.find(&"c"), Some(&13));
416428 /// ```
417- pub fn mut_rev_iter < ' a > ( & ' a mut self ) -> RevMutEntries < ' a , K , V > {
429+ pub fn rev_iter_mut < ' a > ( & ' a mut self ) -> RevMutEntries < ' a , K , V > {
418430 RevMutEntries { iter : self . mut_iter ( ) }
419431 }
420432
433+ /// Deprecated: use `into_iter`.
434+ #[ depreated = "use into_iter" ]
435+ pub fn move_iter ( self ) -> MoveEntries < K , V > {
436+ self . into_iter ( )
437+ }
421438
422439 /// Gets a lazy iterator that consumes the treemap.
423440 ///
@@ -434,7 +451,7 @@ impl<K: Ord, V> TreeMap<K, V> {
434451 /// let vec: Vec<(&str, int)> = map.move_iter().collect();
435452 /// assert_eq!(vec, vec![("a", 1), ("b", 2), ("c", 3)]);
436453 /// ```
437- pub fn move_iter ( self ) -> MoveEntries < K , V > {
454+ pub fn into_iter ( self ) -> MoveEntries < K , V > {
438455 let TreeMap { root : root, length : length } = self ;
439456 let stk = match root {
440457 None => vec ! ( ) ,
@@ -477,6 +494,12 @@ impl<K, V> TreeMap<K, V> {
477494 tree_find_with ( & self . root , f)
478495 }
479496
497+ /// Deprecated: use `find_with_mut`.
498+ #[ deprecated = "use find_with_mut" ]
499+ pub fn find_mut_with < ' a > ( & ' a mut self , f: |& K | -> Ordering ) -> Option < & ' a mut V > {
500+ self . find_with_mut ( f)
501+ }
502+
480503 /// Returns the value for which `f(key)` returns `Equal`. `f` is invoked
481504 /// with current key and guides tree navigation. That means `f` should
482505 /// be aware of natural ordering of the tree.
@@ -497,8 +520,8 @@ impl<K, V> TreeMap<K, V> {
497520 /// assert_eq!(t.find(&"User-Agent"), Some(&new_ua));
498521 /// ```
499522 #[ inline]
500- pub fn find_mut_with < ' a > ( & ' a mut self , f: |& K | -> Ordering ) -> Option < & ' a mut V > {
501- tree_find_mut_with ( & mut self . root , f)
523+ pub fn find_with_mut < ' a > ( & ' a mut self , f: |& K | -> Ordering ) -> Option < & ' a mut V > {
524+ tree_find_with_mut ( & mut self . root , f)
502525 }
503526}
504527
@@ -594,15 +617,21 @@ impl<K: Ord, V> TreeMap<K, V> {
594617
595618 /// Gets a lazy iterator that should be initialized using
596619 /// `traverse_left`/`traverse_right`/`traverse_complete`.
597- fn mut_iter_for_traversal < ' a > ( & ' a mut self ) -> MutEntries < ' a , K , V > {
620+ fn iter_mut_for_traversal < ' a > ( & ' a mut self ) -> MutEntries < ' a , K , V > {
598621 MutEntries {
599622 stack : vec ! ( ) ,
600- node : mut_deref ( & mut self . root ) ,
623+ node : deref_mut ( & mut self . root ) ,
601624 remaining_min : 0 ,
602625 remaining_max : self . length
603626 }
604627 }
605628
629+ /// Deprecated: use `lower_bound_mut`.
630+ #[ deprecated = "use lower_bound_mut" ]
631+ pub fn mut_lower_bound < ' a > ( & ' a mut self , k : & K ) -> MutEntries < ' a , K , V > {
632+ self . lower_bound_mut ( k)
633+ }
634+
606635 /// Returns a lazy value iterator to the first key-value pair (with
607636 /// the value being mutable) whose key is not less than `k`.
608637 ///
@@ -633,8 +662,14 @@ impl<K: Ord, V> TreeMap<K, V> {
633662 /// assert_eq!(map.find(&6), Some(&"changed"));
634663 /// assert_eq!(map.find(&8), Some(&"changed"));
635664 /// ```
636- pub fn mut_lower_bound < ' a > ( & ' a mut self , k : & K ) -> MutEntries < ' a , K , V > {
637- bound_setup ! ( self . mut_iter_for_traversal( ) , k, true )
665+ pub fn lower_bound_mut < ' a > ( & ' a mut self , k : & K ) -> MutEntries < ' a , K , V > {
666+ bound_setup ! ( self . iter_mut_for_traversal( ) , k, true )
667+ }
668+
669+ /// Deprecated: use `upper_bound_mut`.
670+ #[ deprecated = "use upper_bound_mut" ]
671+ pub fn mut_upper_bound < ' a > ( & ' a mut self , k : & K ) -> MutEntries < ' a , K , V > {
672+ self . upper_bound_mut ( k)
638673 }
639674
640675 /// Returns a lazy iterator to the first key-value pair (with the
@@ -667,8 +702,8 @@ impl<K: Ord, V> TreeMap<K, V> {
667702 /// assert_eq!(map.find(&6), Some(&"changed"));
668703 /// assert_eq!(map.find(&8), Some(&"changed"));
669704 /// ```
670- pub fn mut_upper_bound < ' a > ( & ' a mut self , k : & K ) -> MutEntries < ' a , K , V > {
671- bound_setup ! ( self . mut_iter_for_traversal ( ) , k, false )
705+ pub fn upper_bound_mut < ' a > ( & ' a mut self , k : & K ) -> MutEntries < ' a , K , V > {
706+ bound_setup ! ( self . iter_mut_for_traversal ( ) , k, false )
672707 }
673708}
674709
@@ -862,7 +897,7 @@ define_iterator! {
862897define_iterator ! {
863898 MutEntries ,
864899 RevMutEntries ,
865- deref = mut_deref ,
900+ deref = deref_mut ,
866901
867902 addr_mut = mut
868903}
@@ -877,7 +912,7 @@ fn deref<'a, K, V>(node: &'a Option<Box<TreeNode<K, V>>>) -> *const TreeNode<K,
877912 }
878913}
879914
880- fn mut_deref < K , V > ( x : & mut Option < Box < TreeNode < K , V > > > )
915+ fn deref_mut < K , V > ( x : & mut Option < Box < TreeNode < K , V > > > )
881916 -> * mut TreeNode < K , V > {
882917 match * x {
883918 Some ( ref mut n) => {
@@ -1169,6 +1204,12 @@ impl<T: Ord> TreeSet<T> {
11691204 RevSetItems { iter : self . map . rev_iter ( ) }
11701205 }
11711206
1207+ /// Deprecated: use `into_iter`.
1208+ #[ deprecated = "use into_iter" ]
1209+ pub fn move_iter ( self ) -> MoveSetItems < T > {
1210+ self . into_iter ( )
1211+ }
1212+
11721213 /// Creates a consuming iterator, that is, one that moves each value out of the
11731214 /// set in ascending order. The set cannot be used after calling this.
11741215 ///
@@ -1183,8 +1224,8 @@ impl<T: Ord> TreeSet<T> {
11831224 /// assert_eq!(v, vec![1, 2, 3, 4, 5]);
11841225 /// ```
11851226 #[ inline]
1186- pub fn move_iter ( self ) -> MoveSetItems < T > {
1187- self . map . move_iter ( ) . map ( |( value, _) | value)
1227+ pub fn into_iter ( self ) -> MoveSetItems < T > {
1228+ self . map . into_iter ( ) . map ( |( value, _) | value)
11881229 }
11891230
11901231 /// Gets a lazy iterator pointing to the first value not less than `v` (greater or equal).
@@ -1488,7 +1529,7 @@ fn tree_find_with<'r, K, V>(node: &'r Option<Box<TreeNode<K, V>>>,
14881529}
14891530
14901531// See comments above tree_find_with
1491- fn tree_find_mut_with < ' r , K , V > ( node : & ' r mut Option < Box < TreeNode < K , V > > > ,
1532+ fn tree_find_with_mut < ' r , K , V > ( node : & ' r mut Option < Box < TreeNode < K , V > > > ,
14921533 f: |& K | -> Ordering ) -> Option < & ' r mut V > {
14931534
14941535 let mut current = node;
0 commit comments