]> git.lizzy.rs Git - rust.git/commitdiff
Final alpha stabilization of std::slice
authorAaron Turon <aturon@mozilla.com>
Sun, 4 Jan 2015 23:53:00 +0000 (15:53 -0800)
committerAaron Turon <aturon@mozilla.com>
Mon, 5 Jan 2015 22:08:21 +0000 (14:08 -0800)
Marks as `#[stable]`:

* Various iterator structs for stable methods, e.g. `Chunks` and
  `Windows`.
* The `SliceExt` trait itself.

src/libcollections/slice.rs
src/libcore/slice.rs

index 3602bfc10c3079b5b67a5914a7074b9c465f8c48..ceccca561aec794651afffff172bbcde70678a79 100644 (file)
@@ -86,6 +86,7 @@
 //! * 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
@@ -699,7 +701,7 @@ fn binary_search_elem(&self, x: &Self::Item) -> Result<uint, uint> where Self::I
     fn into_vec(self: Box<Self>) -> Vec<Self::Item>;
 }
 
-#[unstable = "trait is unstable"]
+#[stable]
 impl<T> SliceExt for [T] {
     type Item = T;
 
index f17a775cf42407e2981e45b440793cf783c5a33c..8174596e65e520a0b355bfeba7f4f23fc10910f3 100644 (file)
@@ -1083,6 +1083,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 
 /// 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>>
 }
@@ -1090,12 +1091,14 @@ pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
 /// 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>>
 }
@@ -1103,6 +1106,7 @@ pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
 /// 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>>
 }
@@ -1134,7 +1138,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 
 /// 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
@@ -1171,7 +1175,7 @@ fn size_hint(&self) -> (uint, Option<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
@@ -1246,7 +1250,7 @@ fn idx(&mut self, index: uint) -> Option<&'a [T]> {
 /// 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
@@ -1360,7 +1364,7 @@ pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] {
 /// 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 })
 }