Skip to content

Commit 121f6c6

Browse files
committed
Final alpha stabilization of std::slice
Marks as `#[stable]`: * Various iterator structs for stable methods, e.g. `Chunks` and `Windows`. * The `SliceExt` trait itself.
1 parent e921afd commit 121f6c6

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/libcollections/slice.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
//! * Further iterators exist that split, chunk or permute the slice.
8787
8888
#![doc(primitive = "slice")]
89+
#![stable]
8990

9091
use alloc::boxed::Box;
9192
use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
@@ -119,8 +120,9 @@ pub use core::slice::{from_raw_buf, from_raw_mut_buf};
119120
////////////////////////////////////////////////////////////////////////////////
120121

121122
/// Allocating extension methods for slices.
122-
#[unstable = "needs associated types, may merge with other traits"]
123+
#[stable]
123124
pub trait SliceExt for Sized? {
125+
#[stable]
124126
type Item;
125127

126128
/// Sorts the slice, in place, using `compare` to compare
@@ -699,7 +701,7 @@ pub trait SliceExt for Sized? {
699701
fn into_vec(self: Box<Self>) -> Vec<Self::Item>;
700702
}
701703

702-
#[unstable = "trait is unstable"]
704+
#[stable]
703705
impl<T> SliceExt for [T] {
704706
type Item = T;
705707

src/libcore/slice.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,26 +1083,30 @@ impl<T, I: SplitIter + Iterator<Item=T>> Iterator for GenericSplitN<I> {
10831083

10841084
/// An iterator over subslices separated by elements that match a predicate
10851085
/// function, limited to a given number of splits.
1086+
#[stable]
10861087
pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
10871088
inner: GenericSplitN<Split<'a, T, P>>
10881089
}
10891090

10901091
/// An iterator over subslices separated by elements that match a
10911092
/// predicate function, limited to a given number of splits, starting
10921093
/// from the end of the slice.
1094+
#[stable]
10931095
pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
10941096
inner: GenericSplitN<Split<'a, T, P>>
10951097
}
10961098

10971099
/// An iterator over subslices separated by elements that match a predicate
10981100
/// function, limited to a given number of splits.
1101+
#[stable]
10991102
pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
11001103
inner: GenericSplitN<SplitMut<'a, T, P>>
11011104
}
11021105

11031106
/// An iterator over subslices separated by elements that match a
11041107
/// predicate function, limited to a given number of splits, starting
11051108
/// from the end of the slice.
1109+
#[stable]
11061110
pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
11071111
inner: GenericSplitN<SplitMut<'a, T, P>>
11081112
}
@@ -1134,7 +1138,7 @@ forward_iterator! { RSplitNMut: T, &'a mut [T] }
11341138

11351139
/// An iterator over overlapping subslices of length `size`.
11361140
#[derive(Clone)]
1137-
#[experimental = "needs review"]
1141+
#[stable]
11381142
pub struct Windows<'a, T:'a> {
11391143
v: &'a [T],
11401144
size: uint
@@ -1171,7 +1175,7 @@ impl<'a, T> Iterator for Windows<'a, T> {
11711175
/// When the slice len is not evenly divided by the chunk size, the last slice
11721176
/// of the iteration will be the remainder.
11731177
#[derive(Clone)]
1174-
#[experimental = "needs review"]
1178+
#[stable]
11751179
pub struct Chunks<'a, T:'a> {
11761180
v: &'a [T],
11771181
size: uint
@@ -1246,7 +1250,7 @@ impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
12461250
/// An iterator over a slice in (non-overlapping) mutable chunks (`size`
12471251
/// elements at a time). When the slice len is not evenly divided by the chunk
12481252
/// size, the last slice of the iteration will be the remainder.
1249-
#[experimental = "needs review"]
1253+
#[stable]
12501254
pub struct ChunksMut<'a, T:'a> {
12511255
v: &'a mut [T],
12521256
chunk_size: uint
@@ -1360,7 +1364,7 @@ pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] {
13601364
/// not being able to provide a non-aliasing guarantee of the returned mutable
13611365
/// slice.
13621366
#[inline]
1363-
#[unstable = "jshould be renamed to from_raw_parts_mut"]
1367+
#[unstable = "should be renamed to from_raw_parts_mut"]
13641368
pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] {
13651369
transmute(RawSlice { data: *p as *const T, len: len })
13661370
}

0 commit comments

Comments
 (0)