1
Fork 0

Stabilize a few remaining stragglers

* The `io::Seek` trait, and `SeekFrom` enum.
* The `Iterator::{partition, unsip}` methods.
* The `Vec::into_boxed_slice` method.
* The `LinkedList::append` method.
* The `{or_insert, or_insert_with` methods in the `Entry` APIs.
This commit is contained in:
Aaron Turon 2015-03-31 13:47:57 -07:00
parent 80bf31dd51
commit b9ab5fe7c2
6 changed files with 14 additions and 16 deletions

View file

@ -1134,8 +1134,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
} }
} }
#[unstable(feature = "collections", #[stable(feature = "rust1", since = "1.0.0")]
reason = "matches entry v3 specification, waiting for dust to settle")]
/// Ensures a value is in the entry by inserting the default if empty, and returns /// Ensures a value is in the entry by inserting the default if empty, and returns
/// a mutable reference to the value in the entry. /// a mutable reference to the value in the entry.
pub fn or_insert(self, default: V) -> &'a mut V { pub fn or_insert(self, default: V) -> &'a mut V {
@ -1145,8 +1144,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
} }
} }
#[unstable(feature = "collections", #[stable(feature = "rust1", since = "1.0.0")]
reason = "matches entry v3 specification, waiting for dust to settle")]
/// Ensures a value is in the entry by inserting the result of the default function if empty, /// Ensures a value is in the entry by inserting the result of the default function if empty,
/// and returns a mutable reference to the value in the entry. /// and returns a mutable reference to the value in the entry.
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V { pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {

View file

@ -252,6 +252,7 @@ impl<T> LinkedList<T> {
/// } /// }
/// println!("{}", b.len()); // prints 0 /// println!("{}", b.len()); // prints 0
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn append(&mut self, other: &mut LinkedList<T>) { pub fn append(&mut self, other: &mut LinkedList<T>) {
match self.list_tail.resolve() { match self.list_tail.resolve() {
None => { None => {

View file

@ -389,7 +389,7 @@ impl<T> Vec<T> {
/// Note that this will drop any excess capacity. Calling this and /// Note that this will drop any excess capacity. Calling this and
/// converting back to a vector with `into_vec()` is equivalent to calling /// converting back to a vector with `into_vec()` is equivalent to calling
/// `shrink_to_fit()`. /// `shrink_to_fit()`.
#[unstable(feature = "collections")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_boxed_slice(mut self) -> Box<[T]> { pub fn into_boxed_slice(mut self) -> Box<[T]> {
self.shrink_to_fit(); self.shrink_to_fit();
unsafe { unsafe {

View file

@ -553,8 +553,7 @@ pub trait Iterator {
/// assert_eq!(even, [2, 4]); /// assert_eq!(even, [2, 4]);
/// assert_eq!(odd, [1, 3]); /// assert_eq!(odd, [1, 3]);
/// ``` /// ```
#[unstable(feature = "core", #[stable(feature = "rust1", since = "1.0.0")]
reason = "recently added as part of collections reform")]
fn partition<B, F>(self, mut f: F) -> (B, B) where fn partition<B, F>(self, mut f: F) -> (B, B) where
Self: Sized, Self: Sized,
B: Default + Extend<Self::Item>, B: Default + Extend<Self::Item>,
@ -930,7 +929,7 @@ pub trait Iterator {
/// assert_eq!([1, 3], left); /// assert_eq!([1, 3], left);
/// assert_eq!([2, 4], right); /// assert_eq!([2, 4], right);
/// ``` /// ```
#[unstable(feature = "core", reason = "recent addition")] #[stable(feature = "rust1", since = "1.0.0")]
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where
FromA: Default + Extend<A>, FromA: Default + Extend<A>,
FromB: Default + Extend<B>, FromB: Default + Extend<B>,

View file

@ -1482,8 +1482,7 @@ impl<'a, K, V> Entry<'a, K, V> {
} }
} }
#[unstable(feature = "collections", #[stable(feature = "rust1", since = "1.0.0")]
reason = "matches entry v3 specification, waiting for dust to settle")]
/// Ensures a value is in the entry by inserting the default if empty, and returns /// Ensures a value is in the entry by inserting the default if empty, and returns
/// a mutable reference to the value in the entry. /// a mutable reference to the value in the entry.
pub fn or_insert(self, default: V) -> &'a mut V { pub fn or_insert(self, default: V) -> &'a mut V {
@ -1493,8 +1492,7 @@ impl<'a, K, V> Entry<'a, K, V> {
} }
} }
#[unstable(feature = "collections", #[stable(feature = "rust1", since = "1.0.0")]
reason = "matches entry v3 specification, waiting for dust to settle")]
/// Ensures a value is in the entry by inserting the result of the default function if empty, /// Ensures a value is in the entry by inserting the result of the default function if empty,
/// and returns a mutable reference to the value in the entry. /// and returns a mutable reference to the value in the entry.
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V { pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {

View file

@ -441,9 +441,7 @@ pub trait Write {
/// ///
/// The stream typically has a fixed size, allowing seeking relative to either /// The stream typically has a fixed size, allowing seeking relative to either
/// end or the current offset. /// end or the current offset.
#[unstable(feature = "io", reason = "the central `seek` method may be split \ #[stable(feature = "rust1", since = "1.0.0")]
into multiple methods instead of taking \
an enum as an argument")]
pub trait Seek { pub trait Seek {
/// Seek to an offset, in bytes, in a stream /// Seek to an offset, in bytes, in a stream
/// ///
@ -459,14 +457,16 @@ pub trait Seek {
/// # Errors /// # Errors
/// ///
/// Seeking to a negative offset is considered an error /// Seeking to a negative offset is considered an error
#[stable(feature = "rust1", since = "1.0.0")]
fn seek(&mut self, pos: SeekFrom) -> Result<u64>; fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
} }
/// Enumeration of possible methods to seek within an I/O object. /// Enumeration of possible methods to seek within an I/O object.
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, PartialEq, Eq, Clone, Debug)]
#[unstable(feature = "io", reason = "awaiting the stability of Seek")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum SeekFrom { pub enum SeekFrom {
/// Set the offset to the provided number of bytes. /// Set the offset to the provided number of bytes.
#[stable(feature = "rust1", since = "1.0.0")]
Start(u64), Start(u64),
/// Set the offset to the size of this object plus the specified number of /// Set the offset to the size of this object plus the specified number of
@ -474,6 +474,7 @@ pub enum SeekFrom {
/// ///
/// It is possible to seek beyond the end of an object, but is an error to /// It is possible to seek beyond the end of an object, but is an error to
/// seek before byte 0. /// seek before byte 0.
#[stable(feature = "rust1", since = "1.0.0")]
End(i64), End(i64),
/// Set the offset to the current position plus the specified number of /// Set the offset to the current position plus the specified number of
@ -481,6 +482,7 @@ pub enum SeekFrom {
/// ///
/// It is possible to seek beyond the end of an object, but is an error to /// It is possible to seek beyond the end of an object, but is an error to
/// seek before byte 0. /// seek before byte 0.
#[stable(feature = "rust1", since = "1.0.0")]
Current(i64), Current(i64),
} }