//! * Further iterators exist that split, chunk or permute the slice.
#![doc(primitive = "slice")]
+#![stable]
use alloc::boxed::Box;
use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
////////////////////////////////////////////////////////////////////////////////
/// Allocating extension methods for slices.
-#[unstable = "needs associated types, may merge with other traits"]
+#[stable]
pub trait SliceExt for Sized? {
+ #[stable]
type Item;
/// Sorts the slice, in place, using `compare` to compare
fn into_vec(self: Box<Self>) -> Vec<Self::Item>;
}
-#[unstable = "trait is unstable"]
+#[stable]
impl<T> SliceExt for [T] {
type Item = T;
/// An iterator over subslices separated by elements that match a predicate
/// function, limited to a given number of splits.
+#[stable]
pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<Split<'a, T, P>>
}
/// An iterator over subslices separated by elements that match a
/// predicate function, limited to a given number of splits, starting
/// from the end of the slice.
+#[stable]
pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<Split<'a, T, P>>
}
/// An iterator over subslices separated by elements that match a predicate
/// function, limited to a given number of splits.
+#[stable]
pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<SplitMut<'a, T, P>>
}
/// An iterator over subslices separated by elements that match a
/// predicate function, limited to a given number of splits, starting
/// from the end of the slice.
+#[stable]
pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
inner: GenericSplitN<SplitMut<'a, T, P>>
}
/// An iterator over overlapping subslices of length `size`.
#[derive(Clone)]
-#[experimental = "needs review"]
+#[stable]
pub struct Windows<'a, T:'a> {
v: &'a [T],
size: uint
/// When the slice len is not evenly divided by the chunk size, the last slice
/// of the iteration will be the remainder.
#[derive(Clone)]
-#[experimental = "needs review"]
+#[stable]
pub struct Chunks<'a, T:'a> {
v: &'a [T],
size: uint
/// An iterator over a slice in (non-overlapping) mutable chunks (`size`
/// elements at a time). When the slice len is not evenly divided by the chunk
/// size, the last slice of the iteration will be the remainder.
-#[experimental = "needs review"]
+#[stable]
pub struct ChunksMut<'a, T:'a> {
v: &'a mut [T],
chunk_size: uint
/// not being able to provide a non-aliasing guarantee of the returned mutable
/// slice.
#[inline]
-#[unstable = "jshould be renamed to from_raw_parts_mut"]
+#[unstable = "should be renamed to from_raw_parts_mut"]
pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] {
transmute(RawSlice { data: *p as *const T, len: len })
}