提交 5176f677 编写于 作者: E Emilio Cobos Álvarez

slice: Stabilize IterMut::as_slice.

Much like #72584.

As per #58957 there's no blocker for this, and I wanted to use this
today :-)
上级 ec7f258d
......@@ -286,7 +286,6 @@ pub fn into_slice(self) -> &'a mut [T] {
/// Basic usage:
///
/// ```
/// # #![feature(slice_iter_mut_as_slice)]
/// let mut slice: &mut [usize] = &mut [1, 2, 3];
///
/// // First, we get the iterator:
......@@ -299,12 +298,19 @@ pub fn into_slice(self) -> &'a mut [T] {
/// // Now `as_slice` returns "[2, 3]":
/// assert_eq!(iter.as_slice(), &[2, 3]);
/// ```
#[unstable(feature = "slice_iter_mut_as_slice", reason = "recently added", issue = "58957")]
#[stable(feature = "slice_iter_mut_as_slice", since = "1.52.0")]
pub fn as_slice(&self) -> &[T] {
self.make_slice()
}
}
#[stable(feature = "slice_iter_mut_as_slice", since = "1.52.0")]
impl<T> AsRef<[T]> for IterMut<'_, T> {
fn as_ref(&self) -> &[T] {
self.as_slice()
}
}
iterator! {struct IterMut -> *mut T, &'a mut T, mut, {mut}, {}}
/// An internal abstraction over the splitting iterators, so that
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册