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(),
}
}
+ /// 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}
}
}
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
/// 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);
}
}
+ /// 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)`.
/// 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(),
}
}
+ /// 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)`.
///
/// 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>>>>
{
}
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> {
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.
///
/// 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.
///
/// 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.
///
/// 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!(),
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.
/// 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)
}
}
/// 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`.
///
/// 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
/// 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)
}
}
define_iterator! {
MutEntries,
RevMutEntries,
- deref = mut_deref,
+ deref = deref_mut,
addr_mut = mut
}
}
}
-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) => {
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.
///
/// 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).
}
// 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;
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.
///
/// 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;
}
// 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.
///
/// 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`.
/// 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)
}
}
}
}
+ /// 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.
/// }
/// ```
#[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;
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.
/// }
/// ```
#[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()
}
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.
///
/// 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()
}
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
/// 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
/// 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
/// 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
/// }
/// ```
#[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)
}
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}
}
#[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
/// ```
#[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]
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()}
}
/// 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.
*
* 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
/// ```
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.
///
/// 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.
///
/// ```
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.
///
#[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 {
}
#[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);
}
#[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 {
}
#[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 }
}
}
#[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))
}
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>;
}
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()
}
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)`.
/// 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.
/// // 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))
}
}
}
- 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,
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;
}
#[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> {