]> git.lizzy.rs Git - rust.git/commitdiff
Align with _mut conventions
authorAaron Turon <aturon@mozilla.com>
Sun, 14 Sep 2014 22:57:55 +0000 (15:57 -0700)
committerAaron Turon <aturon@mozilla.com>
Tue, 16 Sep 2014 18:46:52 +0000 (11:46 -0700)
As per [RFC
52](https://github.com/rust-lang/rfcs/blob/master/active/0052-ownership-variants.md),
use `_mut` suffixes to mark mutable variants, and `into_iter` for moving
iterators.

[breaking-change]

15 files changed:
src/libcollections/dlist.rs
src/libcollections/ringbuf.rs
src/libcollections/smallintmap.rs
src/libcollections/treemap.rs
src/libcollections/trie.rs
src/libcollections/vec.rs
src/libcore/option.rs
src/libcore/ptr.rs
src/libcore/result.rs
src/libcore/slice.rs
src/librustc/middle/subst.rs
src/libstd/collections/hashmap/map.rs
src/libstd/collections/hashmap/table.rs
src/libstd/io/buffered.rs
src/libsync/comm/mod.rs

index 0ed946aa947db21c95f9c9caaf564cbca4fadc01..cf5c1eed15cd0d0a0ceb9188f723728e53be4e45 100644 (file)
@@ -475,9 +475,15 @@ pub fn iter<'a>(&'a self) -> Items<'a, T> {
         Items{nelem: self.len(), head: &self.list_head, tail: self.list_tail}
     }
 
+    /// Deprecated: use `iter_mut`.
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
+        self.iter_mut()
+    }
+
     /// Provides a forward iterator with mutable references.
     #[inline]
-    pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
+    pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T> {
         let head_raw = match self.list_head {
             Some(ref mut h) => Rawlink::some(&mut **h),
             None => Rawlink::none(),
@@ -490,10 +496,15 @@ pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
         }
     }
 
+    /// Deprecated: use `into_iter`.
+    #[deprecated = "use into_iter"]
+    pub fn move_iter(self) -> MoveItems<T> {
+        self.into_iter()
+    }
 
     /// Consumes the list into an iterator yielding elements by value.
     #[inline]
-    pub fn move_iter(self) -> MoveItems<T> {
+    pub fn into_iter(self) -> MoveItems<T> {
         MoveItems{list: self}
     }
 }
index aa745ef39ee13a23d44da8b96573d30b2a0cb154..a3dc1d30031043a3c5b2c605add79d8517d0186e 100644 (file)
@@ -250,6 +250,12 @@ pub fn iter<'a>(&'a self) -> Items<'a, T> {
         Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
     }
 
+    /// Deprecated: use `iter_mut`
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
+        self.iter_mut()
+    }
+
     /// Returns a front-to-back iterator which returns mutable references.
     ///
     /// # Example
@@ -267,7 +273,7 @@ pub fn iter<'a>(&'a self) -> Items<'a, T> {
     /// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
     /// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), b);
     /// ```
-    pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
+    pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T> {
         let start_index = raw_index(self.lo, self.elts.len(), 0);
         let end_index = raw_index(self.lo, self.elts.len(), self.nelts);
 
index dd3a639aeac787a21765e42cb4d9d041a9564044..aac34bfd15581d81980d2127784a825d076dc04e 100644 (file)
@@ -260,6 +260,12 @@ pub fn iter<'r>(&'r self) -> Entries<'r, V> {
         }
     }
 
+    /// Deprecated: use `iter_mut`
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter<'r>(&'r mut self) -> MutEntries<'r, V> {
+        self.iter_mut()
+    }
+
     /// Returns an iterator visiting all key-value pairs in ascending order by the keys,
     /// with mutable references to the values.
     /// The iterator's element type is `(uint, &'r mut V)`.
@@ -282,7 +288,7 @@ pub fn iter<'r>(&'r self) -> Entries<'r, V> {
     ///     assert_eq!(value, &"x");
     /// }
     /// ```
-    pub fn mut_iter<'r>(&'r mut self) -> MutEntries<'r, V> {
+    pub fn iter_mut<'r>(&'r mut self) -> MutEntries<'r, V> {
         MutEntries {
             front: 0,
             back: self.v.len(),
@@ -290,6 +296,14 @@ pub fn mut_iter<'r>(&'r mut self) -> MutEntries<'r, V> {
         }
     }
 
+    /// Deprecated: use `into_iter` instead.
+    #[deprecated = "use into_iter"]
+    pub fn move_iter(&mut self)
+        -> FilterMap<(uint, Option<V>), (uint, V),
+                Enumerate<vec::MoveItems<Option<V>>>> {
+        self.into_iter()
+    }
+
     /// Returns an iterator visiting all key-value pairs in ascending order by
     /// the keys, emptying (but not consuming) the original `SmallIntMap`.
     /// The iterator's element type is `(uint, &'r V)`.
@@ -309,7 +323,7 @@ pub fn mut_iter<'r>(&'r mut self) -> MutEntries<'r, V> {
     ///
     /// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
     /// ```
-    pub fn move_iter(&mut self)
+    pub fn into_iter(&mut self)
         -> FilterMap<(uint, Option<V>), (uint, V),
                 Enumerate<vec::MoveItems<Option<V>>>>
     {
index 354edae473fd58450e86eed411b3f05ae5b65ba2..0a7c84b5c0c55f2b12bc975d5ae394f40938f675 100644 (file)
@@ -226,10 +226,10 @@ fn find<'a>(&'a self, key: &K) -> Option<&'a V> {
 }
 
 impl<K: Ord, V> MutableMap<K, V> for TreeMap<K, V> {
-    // See comments on def_tree_find_mut_with
+    // See comments on tree_find_with_mut
     #[inline]
     fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V> {
-        tree_find_mut_with(&mut self.root, |x| key.cmp(x))
+        tree_find_with_mut(&mut self.root, |x| key.cmp(x))
     }
 
     fn swap(&mut self, key: K, value: V) -> Option<V> {
@@ -361,6 +361,12 @@ pub fn rev_iter<'a>(&'a self) -> RevEntries<'a, K, V> {
         RevEntries{iter: self.iter()}
     }
 
+    /// Deprecated: use `iter_mut`.
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter<'a>(&'a mut self) -> MutEntries<'a, K, V> {
+        self.iter_mut()
+    }
+
     /// Gets a lazy forward iterator over the key-value pairs in the
     /// map, with the values being mutable.
     ///
@@ -383,15 +389,21 @@ pub fn rev_iter<'a>(&'a self) -> RevEntries<'a, K, V> {
     /// assert_eq!(map.find(&"b"), Some(&12));
     /// assert_eq!(map.find(&"c"), Some(&3));
     /// ```
-    pub fn mut_iter<'a>(&'a mut self) -> MutEntries<'a, K, V> {
+    pub fn iter_mut<'a>(&'a mut self) -> MutEntries<'a, K, V> {
         MutEntries {
             stack: vec!(),
-            node: mut_deref(&mut self.root),
+            node: deref_mut(&mut self.root),
             remaining_min: self.length,
             remaining_max: self.length
         }
     }
 
+    /// Deprecated: use `rev_iter_mut`.
+    #[deprecated = "use rev_iter_mut"]
+    pub fn mut_rev_iter<'a>(&'a mut self) -> RevMutEntries<'a, K, V> {
+        self.rev_iter_mut()
+    }
+
     /// Gets a lazy reverse iterator over the key-value pairs in the
     /// map, with the values being mutable.
     ///
@@ -414,10 +426,15 @@ pub fn mut_iter<'a>(&'a mut self) -> MutEntries<'a, K, V> {
     /// assert_eq!(map.find(&"b"), Some(&12));
     /// assert_eq!(map.find(&"c"), Some(&13));
     /// ```
-    pub fn mut_rev_iter<'a>(&'a mut self) -> RevMutEntries<'a, K, V> {
+    pub fn rev_iter_mut<'a>(&'a mut self) -> RevMutEntries<'a, K, V> {
         RevMutEntries{iter: self.mut_iter()}
     }
 
+    /// Deprecated: use `into_iter`.
+    #[depreated = "use into_iter"]
+    pub fn move_iter(self) -> MoveEntries<K, V> {
+        self.into_iter()
+    }
 
     /// Gets a lazy iterator that consumes the treemap.
     ///
@@ -434,7 +451,7 @@ pub fn mut_rev_iter<'a>(&'a mut self) -> RevMutEntries<'a, K, V> {
     /// let vec: Vec<(&str, int)> = map.move_iter().collect();
     /// assert_eq!(vec, vec![("a", 1), ("b", 2), ("c", 3)]);
     /// ```
-    pub fn move_iter(self) -> MoveEntries<K, V> {
+    pub fn into_iter(self) -> MoveEntries<K, V> {
         let TreeMap { root: root, length: length } = self;
         let stk = match root {
             None => vec!(),
@@ -477,6 +494,12 @@ pub fn find_with<'a>(&'a self, f:|&K| -> Ordering) -> Option<&'a V> {
         tree_find_with(&self.root, f)
     }
 
+    /// Deprecated: use `find_with_mut`.
+    #[deprecated = "use find_with_mut"]
+    pub fn find_mut_with<'a>(&'a mut self, f:|&K| -> Ordering) -> Option<&'a mut V> {
+        self.find_with_mut(f)
+    }
+
     /// Returns the value for which `f(key)` returns `Equal`. `f` is invoked
     /// with current key and guides tree navigation. That means `f` should
     /// be aware of natural ordering of the tree.
@@ -497,8 +520,8 @@ pub fn find_with<'a>(&'a self, f:|&K| -> Ordering) -> Option<&'a V> {
     /// assert_eq!(t.find(&"User-Agent"), Some(&new_ua));
     /// ```
     #[inline]
-    pub fn find_mut_with<'a>(&'a mut self, f:|&K| -> Ordering) -> Option<&'a mut V> {
-        tree_find_mut_with(&mut self.root, f)
+    pub fn find_with_mut<'a>(&'a mut self, f:|&K| -> Ordering) -> Option<&'a mut V> {
+        tree_find_with_mut(&mut self.root, f)
     }
 }
 
@@ -594,15 +617,21 @@ pub fn upper_bound<'a>(&'a self, k: &K) -> Entries<'a, K, V> {
 
     /// Gets a lazy iterator that should be initialized using
     /// `traverse_left`/`traverse_right`/`traverse_complete`.
-    fn mut_iter_for_traversal<'a>(&'a mut self) -> MutEntries<'a, K, V> {
+    fn iter_mut_for_traversal<'a>(&'a mut self) -> MutEntries<'a, K, V> {
         MutEntries {
             stack: vec!(),
-            node: mut_deref(&mut self.root),
+            node: deref_mut(&mut self.root),
             remaining_min: 0,
             remaining_max: self.length
         }
     }
 
+    /// Deprecated: use `lower_bound_mut`.
+    #[deprecated = "use lower_bound_mut"]
+    pub fn mut_lower_bound<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V> {
+        self.lower_bound_mut(k)
+    }
+
     /// Returns a lazy value iterator to the first key-value pair (with
     /// the value being mutable) whose key is not less than `k`.
     ///
@@ -633,8 +662,14 @@ fn mut_iter_for_traversal<'a>(&'a mut self) -> MutEntries<'a, K, V> {
     /// assert_eq!(map.find(&6), Some(&"changed"));
     /// assert_eq!(map.find(&8), Some(&"changed"));
     /// ```
-    pub fn mut_lower_bound<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V> {
-        bound_setup!(self.mut_iter_for_traversal(), k, true)
+    pub fn lower_bound_mut<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V> {
+        bound_setup!(self.iter_mut_for_traversal(), k, true)
+    }
+
+    /// Deprecated: use `upper_bound_mut`.
+    #[deprecated = "use upper_bound_mut"]
+    pub fn mut_upper_bound<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V> {
+        self.upper_bound_mut(k)
     }
 
     /// Returns a lazy iterator to the first key-value pair (with the
@@ -667,8 +702,8 @@ pub fn mut_lower_bound<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V> {
     /// assert_eq!(map.find(&6), Some(&"changed"));
     /// assert_eq!(map.find(&8), Some(&"changed"));
     /// ```
-    pub fn mut_upper_bound<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V> {
-        bound_setup!(self.mut_iter_for_traversal(), k, false)
+    pub fn upper_bound_mut<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V> {
+        bound_setup!(self.iter_mut_for_traversal(), k, false)
     }
 }
 
@@ -862,7 +897,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 define_iterator! {
     MutEntries,
     RevMutEntries,
-    deref = mut_deref,
+    deref = deref_mut,
 
     addr_mut = mut
 }
@@ -877,7 +912,7 @@ fn deref<'a, K, V>(node: &'a Option<Box<TreeNode<K, V>>>) -> *const TreeNode<K,
     }
 }
 
-fn mut_deref<K, V>(x: &mut Option<Box<TreeNode<K, V>>>)
+fn deref_mut<K, V>(x: &mut Option<Box<TreeNode<K, V>>>)
              -> *mut TreeNode<K, V> {
     match *x {
         Some(ref mut n) => {
@@ -1169,6 +1204,12 @@ pub fn rev_iter<'a>(&'a self) -> RevSetItems<'a, T> {
         RevSetItems{iter: self.map.rev_iter()}
     }
 
+    /// Deprecated: use `into_iter`.
+    #[deprecated = "use into_iter"]
+    pub fn move_iter(self) -> MoveSetItems<T> {
+        self.into_iter()
+    }
+
     /// Creates a consuming iterator, that is, one that moves each value out of the
     /// set in ascending order. The set cannot be used after calling this.
     ///
@@ -1183,8 +1224,8 @@ pub fn rev_iter<'a>(&'a self) -> RevSetItems<'a, T> {
     /// assert_eq!(v, vec![1, 2, 3, 4, 5]);
     /// ```
     #[inline]
-    pub fn move_iter(self) -> MoveSetItems<T> {
-        self.map.move_iter().map(|(value, _)| value)
+    pub fn into_iter(self) -> MoveSetItems<T> {
+        self.map.into_iter().map(|(value, _)| value)
     }
 
     /// 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>>>,
 }
 
 // See comments above tree_find_with
-fn tree_find_mut_with<'r, K, V>(node: &'r mut Option<Box<TreeNode<K, V>>>,
+fn tree_find_with_mut<'r, K, V>(node: &'r mut Option<Box<TreeNode<K, V>>>,
                                 f: |&K| -> Ordering) -> Option<&'r mut V> {
 
     let mut current = node;
index 7d60d3a85e1288483d7997f73ef7bcbbc26bac4b..f447bcba917a8951781e1e423ea1f0ec8d0886e1 100644 (file)
@@ -267,6 +267,12 @@ pub fn iter<'a>(&'a self) -> Entries<'a, T> {
         iter
     }
 
+    /// Deprecated: use `iter_mut`.
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter<'a>(&'a mut self) -> MutEntries<'a, T> {
+        self.iter_mut()
+    }
+
     /// Gets an iterator over the key-value pairs in the map, with the
     /// ability to mutate the values.
     ///
@@ -284,7 +290,7 @@ pub fn iter<'a>(&'a self) -> Entries<'a, T> {
     /// assert_eq!(map.find(&2), Some(&-2));
     /// assert_eq!(map.find(&3), Some(&-3));
     /// ```
-    pub fn mut_iter<'a>(&'a mut self) -> MutEntries<'a, T> {
+    pub fn iter_mut<'a>(&'a mut self) -> MutEntries<'a, T> {
         let mut iter = unsafe {MutEntries::new()};
         iter.stack[0] = self.root.children.mut_iter();
         iter.length = 1;
@@ -425,13 +431,19 @@ pub fn upper_bound<'a>(&'a self, key: uint) -> Entries<'a, T> {
     }
     // If `upper` is true then returns upper_bound else returns lower_bound.
     #[inline]
-    fn mut_bound<'a>(&'a mut self, key: uint, upper: bool) -> MutEntries<'a, T> {
+    fn bound_mut<'a>(&'a mut self, key: uint, upper: bool) -> MutEntries<'a, T> {
         bound!(MutEntries, self = self,
                key = key, is_upper = upper,
                slice_from = mut_slice_from, iter = mut_iter,
                mutability = mut)
     }
 
+    /// Deprecated: use `lower_bound_mut`.
+    #[deprecated = "use lower_bound_mut"]
+    pub fn mut_lower_bound<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> {
+        self.lower_bound_mut(key)
+    }
+
     /// Gets an iterator pointing to the first key-value pair whose key is not less than `key`.
     /// If all keys in the map are less than `key` an empty iterator is returned.
     ///
@@ -453,8 +465,14 @@ fn mut_bound<'a>(&'a mut self, key: uint, upper: bool) -> MutEntries<'a, T> {
     /// assert_eq!(map.find(&4), Some(&"changed"));
     /// assert_eq!(map.find(&6), Some(&"changed"));
     /// ```
-    pub fn mut_lower_bound<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> {
-        self.mut_bound(key, false)
+    pub fn lower_bound_mut<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> {
+        self.bound_mut(key, false)
+    }
+
+    /// Deprecated: use `upper_bound_mut`.
+    #[deprecated = "use upper_bound_mut"]
+    pub fn mut_upper_bound<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> {
+        self.upper_bound_mut(key)
     }
 
     /// Gets an iterator pointing to the first key-value pair whose key is greater than `key`.
@@ -478,8 +496,8 @@ pub fn mut_lower_bound<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> {
     /// assert_eq!(map.find(&4), Some(&"b"));
     /// assert_eq!(map.find(&6), Some(&"changed"));
     /// ```
-    pub fn mut_upper_bound<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> {
-        self.mut_bound(key, true)
+    pub fn upper_bound_mut<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> {
+        self.bound_mut(key, true)
     }
 }
 
index 5215e8aaab88f8725401da7bc585fced11ab8dde..3557390ef9651af9a86516533a37034ce1d73d10 100644 (file)
@@ -724,6 +724,12 @@ pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
         }
     }
 
+    /// Deprecated: use `into_iter`.
+    #[deprecated = "use into_iter"]
+    pub fn move_iter(self) -> MoveItems<T> {
+        self.into_iter()
+    }
+
     /// Creates a consuming iterator, that is, one that moves each
     /// value out of the vector (from start to end). The vector cannot
     /// be used after calling this.
@@ -738,7 +744,7 @@ pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
     /// }
     /// ```
     #[inline]
-    pub fn move_iter(self) -> MoveItems<T> {
+    pub fn into_iter(self) -> MoveItems<T> {
         unsafe {
             let iter = mem::transmute(self.as_slice().iter());
             let ptr = self.ptr;
@@ -822,6 +828,11 @@ pub fn iter<'a>(&'a self) -> Items<'a,T> {
         self.as_slice().iter()
     }
 
+    /// Deprecated: use `iter_mut`.
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a,T> {
+        self.iter_mut()
+    }
 
     /// Returns an iterator over mutable references to the elements of the
     /// vector in order.
@@ -835,7 +846,7 @@ pub fn iter<'a>(&'a self) -> Items<'a,T> {
     /// }
     /// ```
     #[inline]
-    pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a,T> {
+    pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a,T> {
         self.as_mut_slice().mut_iter()
     }
 
@@ -927,6 +938,12 @@ pub fn last<'a>(&'a self) -> Option<&'a T> {
         self.as_slice().last()
     }
 
+    /// Deprecated: use `last_mut`.
+    #[deprecated = "use last_mut"]
+    pub fn mut_last<'a>(&'a mut self) -> Option<&'a mut T> {
+        self.last_mut()
+    }
+
     /// Returns a mutable reference to the last element of a vector, or `None`
     /// if it is empty.
     ///
@@ -938,7 +955,7 @@ pub fn last<'a>(&'a self) -> Option<&'a T> {
     /// assert_eq!(vec, vec![1i, 2, 4]);
     /// ```
     #[inline]
-    pub fn mut_last<'a>(&'a mut self) -> Option<&'a mut T> {
+    pub fn last_mut<'a>(&'a mut self) -> Option<&'a mut T> {
         self.as_mut_slice().mut_last()
     }
 
@@ -1105,6 +1122,13 @@ pub fn push_all_move(&mut self, other: Vec<T>) {
         self.extend(other.move_iter());
     }
 
+    /// Deprecated: use `slice_mut`.
+    #[deprecated = "use slice_mut"]
+    pub fn mut_slice<'a>(&'a mut self, start: uint, end: uint)
+                         -> &'a mut [T] {
+        self.slice_mut(start, end)
+    }
+
     /// Returns a mutable slice of `self` between `start` and `end`.
     ///
     /// # Failure
@@ -1119,11 +1143,17 @@ pub fn push_all_move(&mut self, other: Vec<T>) {
     /// assert!(vec.mut_slice(0, 2) == [1, 2]);
     /// ```
     #[inline]
-    pub fn mut_slice<'a>(&'a mut self, start: uint, end: uint)
+    pub fn slice_mut<'a>(&'a mut self, start: uint, end: uint)
                          -> &'a mut [T] {
         self.as_mut_slice().mut_slice(start, end)
     }
 
+    /// Deprecated: use "slice_from_mut".
+    #[deprecated = "use slice_from_mut"]
+    pub fn mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
+        self.slice_from_mut(start)
+    }
+
     /// Returns a mutable slice of `self` from `start` to the end of the `Vec`.
     ///
     /// # Failure
@@ -1137,10 +1167,16 @@ pub fn mut_slice<'a>(&'a mut self, start: uint, end: uint)
     /// assert!(vec.mut_slice_from(2) == [3, 4]);
     /// ```
     #[inline]
-    pub fn mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
+    pub fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
         self.as_mut_slice().mut_slice_from(start)
     }
 
+    /// Deprecated: use `slice_to_mut`.
+    #[deprecated = "use slice_to_mut"]
+    pub fn mut_slice_to<'a>(&'a mut self, end: uint) -> &'a mut [T] {
+        self.slice_to_mut(end)
+    }
+
     /// Returns a mutable slice of `self` from the start of the `Vec` to `end`.
     ///
     /// # Failure
@@ -1154,10 +1190,16 @@ pub fn mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
     /// assert!(vec.mut_slice_to(2) == [1, 2]);
     /// ```
     #[inline]
-    pub fn mut_slice_to<'a>(&'a mut self, end: uint) -> &'a mut [T] {
+    pub fn slice_to_mut<'a>(&'a mut self, end: uint) -> &'a mut [T] {
         self.as_mut_slice().mut_slice_to(end)
     }
 
+    /// Deprecated: use `split_at_mut`.
+    #[deprecated = "use split_at_mut"]
+    pub fn mut_split_at<'a>(&'a mut self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
+        self.split_at_mut(mid)
+    }
+
     /// Returns a pair of mutable slices that divides the `Vec` at an index.
     ///
     /// The first will contain all indices from `[0, mid)` (excluding
@@ -1193,7 +1235,7 @@ pub fn mut_slice_to<'a>(&'a mut self, end: uint) -> &'a mut [T] {
     /// }
     /// ```
     #[inline]
-    pub fn mut_split_at<'a>(&'a mut self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
+    pub fn split_at_mut<'a>(&'a mut self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
         self.as_mut_slice().mut_split_at(mid)
     }
 
index 537d78a67feb2230188246c1d81d9a0f47e95f46..cd6e8f3e666e10fdd29ecaed7cda5333cd483071 100644 (file)
@@ -372,17 +372,29 @@ pub fn iter<'r>(&'r self) -> Item<&'r T> {
         Item{opt: self.as_ref()}
     }
 
+    /// Deprecated: use `iter_mut`
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> {
+        self.iter_mut()
+    }
+
     /// Returns a mutable iterator over the possibly contained value.
     #[inline]
     #[unstable = "waiting for iterator conventions"]
-    pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> {
+    pub fn iter_mut<'r>(&'r mut self) -> Item<&'r mut T> {
         Item{opt: self.as_mut()}
     }
 
+    /// Deprecated: use `into_iter`.
+    #[deprecated = "use into_iter"]
+    pub fn move_iter(self) -> Item<T> {
+        self.into_iter()
+    }
+
     /// Returns a consuming iterator over the possibly contained value.
     #[inline]
     #[unstable = "waiting for iterator conventions"]
-    pub fn move_iter(self) -> Item<T> {
+    pub fn into_iter(self) -> Item<T> {
         Item{opt: self}
     }
 
index d1bea25dded41f2e36fbf9e3d69b1420414eeb94..42416a640bf653e47c7c1fb5f5e0c6d2be68ea82 100644 (file)
 #[unstable = "may need a different name after pending changes to pointer types"]
 pub fn null<T>() -> *const T { 0 as *const T }
 
+/// Deprecated: use `null_mut`.
+#[deprecated = "use null_mut"]
+pub fn mut_null<T>() -> *mut T { null_mut() }
+
 /// Create an unsafe mutable null pointer.
 ///
 /// # Example
@@ -125,7 +129,7 @@ pub fn null<T>() -> *const T { 0 as *const T }
 /// ```
 #[inline]
 #[unstable = "may need a different name after pending changes to pointer types"]
-pub fn mut_null<T>() -> *mut T { 0 as *mut T }
+pub fn null_mut<T>() -> *mut T { 0 as *mut T }
 
 /// Zeroes out `count * size_of::<T>` bytes of memory at `dst`
 #[inline]
index bf351ecc89b1fd44702ef8c049c730fc6c99aaf2..426ae8f09298c0d7c7b88d24e99ba112a6235658 100644 (file)
@@ -500,17 +500,29 @@ pub fn iter<'r>(&'r self) -> Item<&'r T> {
         Item{opt: self.as_ref().ok()}
     }
 
+    /// Deprecated: use `iter_mut`.
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> {
+        self.iter_mut()
+    }
+
     /// Returns a mutable iterator over the possibly contained value.
     #[inline]
     #[unstable = "waiting for iterator conventions"]
-    pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> {
+    pub fn iter_mut<'r>(&'r mut self) -> Item<&'r mut T> {
         Item{opt: self.as_mut().ok()}
     }
 
+    /// Deprecated: `use into_iter`.
+    #[deprecated = "use into_iter"]
+    pub fn move_iter(self) -> Item<T> {
+        self.into_iter()
+    }
+
     /// Returns a consuming iterator over the possibly contained value.
     #[inline]
     #[unstable = "waiting for iterator conventions"]
-    pub fn move_iter(self) -> Item<T> {
+    pub fn into_iter(self) -> Item<T> {
         Item{opt: self.ok()}
     }
 
index cc2b01e3bb58b74dcb3193ea0410c71a8ec621be..05b0c1e4f70ba49f9624fa7ff2119aa17db65819 100644 (file)
@@ -486,38 +486,80 @@ pub trait MutableSlice<'a, T> {
     /// Primarily intended for getting a &mut [T] from a [T, ..N].
     fn as_mut_slice(self) -> &'a mut [T];
 
+    /// Deprecated: use `slice_mut`.
+    #[deprecated = "use slice_mut"]
+    fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] {
+        self.slice_mut(start, end)
+    }
+
     /// Returns a mutable subslice spanning the interval [`start`, `end`).
     ///
     /// Fails when the end of the new slice lies beyond the end of the
     /// original slice (i.e. when `end > self.len()`) or when `start > end`.
     ///
     /// Slicing with `start` equal to `end` yields an empty slice.
-    fn mut_slice(self, start: uint, end: uint) -> &'a mut [T];
+    fn slice_mut(self, start: uint, end: uint) -> &'a mut [T];
+
+    /// Deprecated: use `slice_from_mut`.
+    #[deprecated = "use slice_from_mut"]
+    fn mut_slice_from(self, start: uint) -> &'a mut [T] {
+        self.slice_from_mut(start)
+    }
 
     /// Returns a mutable subslice from `start` to the end of the slice.
     ///
     /// Fails when `start` is strictly greater than the length of the original slice.
     ///
     /// Slicing from `self.len()` yields an empty slice.
-    fn mut_slice_from(self, start: uint) -> &'a mut [T];
+    fn slice_from_mut(self, start: uint) -> &'a mut [T];
+
+    /// Deprecated: use `slice_to_mut`.
+    #[deprecated = "use slice_to_mut"]
+    fn mut_slice_to(self, end: uint) -> &'a mut [T] {
+        self.slice_to_mut(end)
+    }
 
     /// Returns a mutable subslice from the start of the slice to `end`.
     ///
     /// Fails when `end` is strictly greater than the length of the original slice.
     ///
     /// Slicing to `0` yields an empty slice.
-    fn mut_slice_to(self, end: uint) -> &'a mut [T];
+    fn slice_to_mut(self, end: uint) -> &'a mut [T];
+
+    /// Deprecated: use `iter_mut`.
+    #[deprecated = "use iter_mut"]
+    fn mut_iter(self) -> MutItems<'a, T> {
+        self.iter_mut()
+    }
 
     /// Returns an iterator that allows modifying each value
-    fn mut_iter(self) -> MutItems<'a, T>;
+    fn iter_mut(self) -> MutItems<'a, T>;
+
+    /// Deprecated: use `last_mut`.
+    #[deprecated = "use last_mut"]
+    fn mut_last(self) -> Option<&'a mut T> {
+        self.last_mut()
+    }
 
     /// Returns a mutable pointer to the last item in the vector.
-    fn mut_last(self) -> Option<&'a mut T>;
+    fn last_mut(self) -> Option<&'a mut T>;
+
+    /// Deprecated: use `split_mut`.
+    #[deprecated = "use split_mut"]
+    fn mut_split(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T> {
+        self.split_mut(pred)
+    }
 
     /// Returns an iterator over the mutable subslices of the vector
     /// which are separated by elements that match `pred`.  The
     /// matched element is not contained in the subslices.
-    fn mut_split(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T>;
+    fn split_mut(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T>;
+
+    /// Deprecated: use `chunks_mut`.
+    #[deprecated = "use chunks_mut"]
+    fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T> {
+        self.chunks_mut(chunk_size)
+    }
 
     /**
      * Returns an iterator over `chunk_size` elements of the vector at a time.
@@ -529,7 +571,7 @@ pub trait MutableSlice<'a, T> {
      *
      * Fails if `chunk_size` is 0.
      */
-    fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T>;
+    fn chunks_mut(self, chunk_size: uint) -> MutChunks<'a, T>;
 
     /**
      * Returns a mutable reference to the first element in this slice
@@ -587,6 +629,11 @@ pub trait MutableSlice<'a, T> {
     /// ```
     fn swap(self, a: uint, b: uint);
 
+    /// Deprecated: use `split_at_mut`.
+    #[deprecated = "use split_at_mut"]
+    fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
+        self.split_at_mut(mid)
+    }
 
     /// Divides one `&mut` into two at an index.
     ///
@@ -620,7 +667,7 @@ pub trait MutableSlice<'a, T> {
     ///     assert!(right == &mut []);
     /// }
     /// ```
-    fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]);
+    fn split_at_mut(self, mid: uint) -> (&'a mut [T], &'a mut [T]);
 
     /// Reverse the order of elements in a vector, in place.
     ///
@@ -633,8 +680,14 @@ pub trait MutableSlice<'a, T> {
     /// ```
     fn reverse(self);
 
+    /// Deprecated: use `unsafe_mut`.
+    #[deprecated = "use unsafe_mut"]
+    unsafe fn unsafe_mut_ref(self, index: uint) -> &'a mut T {
+        self.unsafe_mut(index)
+    }
+
     /// Returns an unsafe mutable pointer to the element in index
-    unsafe fn unsafe_mut_ref(self, index: uint) -> &'a mut T;
+    unsafe fn unsafe_mut(self, index: uint) -> &'a mut T;
 
     /// Return an unsafe mutable pointer to the vector's buffer.
     ///
@@ -701,7 +754,7 @@ fn get_mut(self, index: uint) -> Option<&'a mut T> {
     #[inline]
     fn as_mut_slice(self) -> &'a mut [T] { self }
 
-    fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] {
+    fn slice_mut(self, start: uint, end: uint) -> &'a mut [T] {
         assert!(start <= end);
         assert!(end <= self.len());
         unsafe {
@@ -713,18 +766,18 @@ fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] {
     }
 
     #[inline]
-    fn mut_slice_from(self, start: uint) -> &'a mut [T] {
+    fn slice_from_mut(self, start: uint) -> &'a mut [T] {
         let len = self.len();
         self.mut_slice(start, len)
     }
 
     #[inline]
-    fn mut_slice_to(self, end: uint) -> &'a mut [T] {
+    fn slice_to_mut(self, end: uint) -> &'a mut [T] {
         self.mut_slice(0, end)
     }
 
     #[inline]
-    fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
+    fn split_at_mut(self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
         unsafe {
             let len = self.len();
             let self2: &'a mut [T] = mem::transmute_copy(&self);
@@ -733,7 +786,7 @@ fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
     }
 
     #[inline]
-    fn mut_iter(self) -> MutItems<'a, T> {
+    fn iter_mut(self) -> MutItems<'a, T> {
         unsafe {
             let p = self.as_mut_ptr();
             if mem::size_of::<T>() == 0 {
@@ -751,19 +804,19 @@ fn mut_iter(self) -> MutItems<'a, T> {
     }
 
     #[inline]
-    fn mut_last(self) -> Option<&'a mut T> {
+    fn last_mut(self) -> Option<&'a mut T> {
         let len = self.len();
         if len == 0 { return None; }
         Some(&mut self[len - 1])
     }
 
     #[inline]
-    fn mut_split(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T> {
+    fn split_mut(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T> {
         MutSplits { v: self, pred: pred, finished: false }
     }
 
     #[inline]
-    fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T> {
+    fn chunks_mut(self, chunk_size: uint) -> MutChunks<'a, T> {
         assert!(chunk_size > 0);
         MutChunks { v: self, chunk_size: chunk_size }
     }
@@ -817,7 +870,7 @@ fn reverse(self) {
     }
 
     #[inline]
-    unsafe fn unsafe_mut_ref(self, index: uint) -> &'a mut T {
+    unsafe fn unsafe_mut(self, index: uint) -> &'a mut T {
         transmute((self.repr().data as *mut T).offset(index as int))
     }
 
index d7e6fd18ed5633a5d602de61f3a20e9e9c33d019..5559f222fe219d906782c8788e3c3a47b12ec756 100644 (file)
@@ -32,7 +32,7 @@ trait HomogeneousTuple3<T> {
     fn as_slice<'a>(&'a self) -> &'a [T];
     fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T];
     fn iter<'a>(&'a self) -> Items<'a, T>;
-    fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T>;
+    fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T>;
     fn get<'a>(&'a self, index: uint) -> Option<&'a T>;
     fn get_mut<'a>(&'a mut self, index: uint) -> Option<&'a mut T>;
 }
@@ -63,7 +63,7 @@ fn iter<'a>(&'a self) -> Items<'a, T> {
         slice.iter()
     }
 
-    fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
+    fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T> {
         self.as_mut_slice().mut_iter()
     }
 
index a50c6a59f7e04b463411fcbb00f1a073c6b16e95..4a58f4e75de705467758da9db0385adb91b07864 100644 (file)
@@ -1193,6 +1193,12 @@ pub fn iter(&self) -> Entries<K, V> {
         Entries { inner: self.table.iter() }
     }
 
+    /// Deprecated: use `iter_mut`.
+    #[deprecated = "use iter_mut"]
+    pub fn mut_iter(&mut self) -> MutEntries<K, V> {
+        self.iter_mut()
+    }
+
     /// An iterator visiting all key-value pairs in arbitrary order,
     /// with mutable references to the values.
     /// Iterator element type is `(&'a K, &'a mut V)`.
@@ -1216,10 +1222,16 @@ pub fn iter(&self) -> Entries<K, V> {
     ///     println!("key: {} val: {}", key, val);
     /// }
     /// ```
-    pub fn mut_iter(&mut self) -> MutEntries<K, V> {
+    pub fn iter_mut(&mut self) -> MutEntries<K, V> {
         MutEntries { inner: self.table.mut_iter() }
     }
 
+    /// Deprecated: use `into_iter`.
+    #[deprecated = "use into_iter"]
+    pub fn move_iter(self) -> MoveEntries<K, V> {
+        self.into_iter()
+    }
+
     /// Creates a consuming iterator, that is, one that moves each key-value
     /// pair out of the map in arbitrary order. The map cannot be used after
     /// calling this.
@@ -1237,7 +1249,7 @@ pub fn mut_iter(&mut self) -> MutEntries<K, V> {
     /// // Not possible with .iter()
     /// let vec: Vec<(&str, int)> = map.move_iter().collect();
     /// ```
-    pub fn move_iter(self) -> MoveEntries<K, V> {
+    pub fn into_iter(self) -> MoveEntries<K, V> {
         MoveEntries {
             inner: self.table.move_iter().map(|(_, k, v)| (k, v))
         }
index 2edb8cd092e0c61e4107f0b17c3feb0ec59beb4c..33e760f11cea44e7bdedbcc22a9a203d2c9d105e 100644 (file)
@@ -674,14 +674,14 @@ pub fn iter(&self) -> Entries<K, V> {
         }
     }
 
-    pub fn mut_iter(&mut self) -> MutEntries<K, V> {
+    pub fn iter_mut(&mut self) -> MutEntries<K, V> {
         MutEntries {
             iter: self.raw_buckets(),
             elems_left: self.size(),
         }
     }
 
-    pub fn move_iter(self) -> MoveEntries<K, V> {
+    pub fn into_iter(self) -> MoveEntries<K, V> {
         MoveEntries {
             iter: self.raw_buckets(),
             table: self,
index 0c63f1a901f5a248cfef32e275e908c1b94c24b6..76f86d66ff5465fdda123a30d43fd8747b90b304 100644 (file)
@@ -265,7 +265,7 @@ fn flush(&mut self) -> IoResult<()> { self.inner.flush() }
 struct InternalBufferedWriter<W>(BufferedWriter<W>);
 
 impl<W> InternalBufferedWriter<W> {
-    fn get_mut_ref<'a>(&'a mut self) -> &'a mut BufferedWriter<W> {
+    fn get_mut<'a>(&'a mut self) -> &'a mut BufferedWriter<W> {
         let InternalBufferedWriter(ref mut w) = *self;
         return w;
     }
index 9177fa4a6b446958c7e418b44752ee6ef688b86c..e46f52b3ad7b97dfea5438c787fb6c7fc06ae23c 100644 (file)
@@ -449,7 +449,7 @@ enum Flavor<T> {
 #[doc(hidden)]
 trait UnsafeFlavor<T> {
     fn inner_unsafe<'a>(&'a self) -> &'a UnsafeCell<Flavor<T>>;
-    unsafe fn mut_inner<'a>(&'a self) -> &'a mut Flavor<T> {
+    unsafe fn inner_mut<'a>(&'a self) -> &'a mut Flavor<T> {
         &mut *self.inner_unsafe().get()
     }
     unsafe fn inner<'a>(&'a self) -> &'a Flavor<T> {