collections: Split the collections feature

This commit also deprecates the `as_string` and `as_slice` free functions in the
`string` and `vec` modules.
This commit is contained in:
Alex Crichton 2015-06-09 14:39:23 -07:00
parent c44f5399e4
commit d444d0c357
30 changed files with 197 additions and 155 deletions

View File

@ -10,10 +10,11 @@
//! A priority queue implemented with a binary heap.
//!
//! Insertion and popping the largest element have `O(log n)` time complexity. Checking the largest
//! element is `O(1)`. Converting a vector to a binary heap can be done in-place, and has `O(n)`
//! complexity. A binary heap can also be converted to a sorted vector in-place, allowing it to
//! be used for an `O(n log n)` in-place heapsort.
//! Insertion and popping the largest element have `O(log n)` time complexity.
//! Checking the largest element is `O(1)`. Converting a vector to a binary heap
//! can be done in-place, and has `O(n)` complexity. A binary heap can also be
//! converted to a sorted vector in-place, allowing it to be used for an `O(n
//! log n)` in-place heapsort.
//!
//! # Examples
//!
@ -539,8 +540,9 @@ impl<T: Ord> BinaryHeap<T> {
///
/// The elements are removed in arbitrary order.
#[inline]
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
#[unstable(feature = "drain",
reason = "matches collection reform specification, \
waiting for dust to settle")]
pub fn drain(&mut self) -> Drain<T> {
Drain { iter: self.data.drain(..) }
}
@ -678,7 +680,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
impl<T> ExactSizeIterator for IntoIter<T> {}
/// An iterator that drains a `BinaryHeap`.
#[unstable(feature = "collections", reason = "recent addition")]
#[unstable(feature = "drain", reason = "recent addition")]
pub struct Drain<'a, T: 'a> {
iter: vec::Drain<'a, T>,
}

View File

@ -156,8 +156,7 @@ const FALSE: &'static bool = &false;
/// println!("{:?}", bv);
/// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
/// ```
#[unstable(feature = "collections",
reason = "RFC 509")]
#[unstable(feature = "bitvec", reason = "RFC 509")]
pub struct BitVec {
/// Internal representation of the bit vector
storage: Vec<u32>,
@ -181,14 +180,16 @@ impl Index<usize> for BitVec {
/// Computes how many blocks are needed to store that many bits
fn blocks_for_bits(bits: usize) -> usize {
// If we want 17 bits, dividing by 32 will produce 0. So we add 1 to make sure we
// reserve enough. But if we want exactly a multiple of 32, this will actually allocate
// one too many. So we need to check if that's the case. We can do that by computing if
// bitwise AND by `32 - 1` is 0. But LLVM should be able to optimize the semantically
// superior modulo operator on a power of two to this.
// If we want 17 bits, dividing by 32 will produce 0. So we add 1 to make
// sure we reserve enough. But if we want exactly a multiple of 32, this
// will actually allocate one too many. So we need to check if that's the
// case. We can do that by computing if bitwise AND by `32 - 1` is 0. But
// LLVM should be able to optimize the semantically superior modulo operator
// on a power of two to this.
//
// Note that we can technically avoid this branch with the expression
// `(nbits + u32::BITS - 1) / 32::BITS`, but if nbits is almost usize::MAX this will overflow.
// `(nbits + u32::BITS - 1) / 32::BITS`, but if nbits is almost usize::MAX
// this will overflow.
if bits % u32::BITS == 0 {
bits / u32::BITS
} else {
@ -202,6 +203,7 @@ fn mask_for_bits(bits: usize) -> u32 {
!0 >> (u32::BITS - bits % u32::BITS) % u32::BITS
}
#[unstable(feature = "bitvec", reason = "RFC 509")]
impl BitVec {
/// Applies the given operation to the blocks of self and other, and sets
/// self to be the result. This relies on the caller not to corrupt the
@ -407,8 +409,6 @@ impl BitVec {
/// assert_eq!(bv[3], true);
/// ```
#[inline]
#[unstable(feature = "collections",
reason = "panic semantics are likely to change in the future")]
pub fn set(&mut self, i: usize, x: bool) {
assert!(i < self.nbits);
let w = i / u32::BITS;
@ -608,7 +608,7 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(collections, bit_vec_append_split_off)]
/// # #![feature(bitvec, append)]
/// use std::collections::BitVec;
///
/// let mut a = BitVec::from_bytes(&[0b10000000]);
@ -621,7 +621,7 @@ impl BitVec {
/// assert!(a.eq_vec(&[true, false, false, false, false, false, false, false,
/// false, true, true, false, false, false, false, true]));
/// ```
#[unstable(feature = "bit_vec_append_split_off",
#[unstable(feature = "append",
reason = "recently added as part of collections reform 2")]
pub fn append(&mut self, other: &mut Self) {
let b = self.len() % u32::BITS;
@ -651,7 +651,7 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(collections, bit_vec_append_split_off)]
/// # #![feature(bitvec, split_off)]
/// use std::collections::BitVec;
/// let mut a = BitVec::new();
/// a.push(true);
@ -666,7 +666,7 @@ impl BitVec {
/// assert!(a.eq_vec(&[true, false]));
/// assert!(b.eq_vec(&[false, true]));
/// ```
#[unstable(feature = "bit_vec_append_split_off",
#[unstable(feature = "split_off",
reason = "recently added as part of collections reform 2")]
pub fn split_off(&mut self, at: usize) -> Self {
assert!(at <= self.len(), "`at` out of bounds");
@ -1254,8 +1254,7 @@ impl<'a> IntoIterator for &'a BitVec {
/// assert!(bv[3]);
/// ```
#[derive(Clone)]
#[unstable(feature = "collections",
reason = "RFC 509")]
#[unstable(feature = "bitset", reason = "RFC 509")]
pub struct BitSet {
bit_vec: BitVec,
}
@ -1322,6 +1321,7 @@ impl cmp::PartialEq for BitSet {
#[stable(feature = "rust1", since = "1.0.0")]
impl cmp::Eq for BitSet {}
#[unstable(feature = "bitset", reason = "RFC 509")]
impl BitSet {
/// Creates a new empty `BitSet`.
///
@ -1808,7 +1808,7 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(collections, bit_set_append_split_off)]
/// # #![feature(collections, append)]
/// use std::collections::{BitVec, BitSet};
///
/// let mut a = BitSet::new();
@ -1826,7 +1826,7 @@ impl BitSet {
/// assert_eq!(b.len(), 0);
/// assert_eq!(a, BitSet::from_bit_vec(BitVec::from_bytes(&[0b01110010])));
/// ```
#[unstable(feature = "bit_set_append_split_off",
#[unstable(feature = "append",
reason = "recently added as part of collections reform 2")]
pub fn append(&mut self, other: &mut Self) {
self.union_with(other);
@ -1839,7 +1839,7 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(collections, bit_set_append_split_off)]
/// # #![feature(bitset, split_off)]
/// use std::collections::{BitSet, BitVec};
/// let mut a = BitSet::new();
/// a.insert(2);
@ -1854,7 +1854,7 @@ impl BitSet {
/// assert_eq!(a, BitSet::from_bit_vec(BitVec::from_bytes(&[0b01100000])));
/// assert_eq!(b, BitSet::from_bit_vec(BitVec::from_bytes(&[0b00010010])));
/// ```
#[unstable(feature = "bit_set_append_split_off",
#[unstable(feature = "split_off",
reason = "recently added as part of collections reform 2")]
pub fn split_off(&mut self, at: usize) -> Self {
let mut other = BitSet::new();

View File

@ -1520,7 +1520,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// }
/// assert_eq!(Some((&5, &"b")), map.range(Included(&4), Unbounded).next());
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn range<'a>(&'a self, min: Bound<&K>, max: Bound<&K>) -> Range<'a, K, V> {
range_impl!(&self.root, min, max, as_slices_internal, iter, Range, edges, [])
@ -1548,7 +1548,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// println!("{} => {}", name, balance);
/// }
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn range_mut<'a>(&'a mut self, min: Bound<&K>, max: Bound<&K>) -> RangeMut<'a, K, V> {
range_impl!(&mut self.root, min, max, as_slices_internal_mut, iter_mut, RangeMut,

View File

@ -102,7 +102,7 @@ impl<T: Ord> BTreeSet<T> {
/// Makes a new BTreeSet with the given B.
///
/// B cannot be less than 2.
#[unstable(feature = "collections",
#[unstable(feature = "btree_b",
reason = "probably want this to be on the type, eventually")]
pub fn with_b(b: usize) -> BTreeSet<T> {
BTreeSet { map: BTreeMap::with_b(b) }
@ -154,7 +154,7 @@ impl<T: Ord> BTreeSet<T> {
/// }
/// assert_eq!(Some(&5), set.range(Included(&4), Unbounded).next());
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn range<'a>(&'a self, min: Bound<&T>, max: Bound<&T>) -> Range<'a, T> {
fn first<A, B>((a, _): (A, B)) -> A { a }

View File

@ -13,21 +13,26 @@
//! This module defines a container which uses an efficient bit mask
//! representation to hold C-like enum variants.
#![unstable(feature = "enumset",
reason = "matches collection reform specification, \
waiting for dust to settle")]
use core::prelude::*;
use core::marker;
use core::fmt;
use core::iter::{FromIterator};
use core::ops::{Sub, BitOr, BitAnd, BitXor};
// FIXME(contentions): implement union family of methods? (general design may be wrong here)
// FIXME(contentions): implement union family of methods? (general design may be
// wrong here)
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
/// A specialized set implementation to use enum types.
///
/// It is a logic error for an item to be modified in such a way that the transformation of the
/// item to or from a `usize`, as determined by the `CLike` trait, changes while the item is in the
/// set. This is normally only possible through `Cell`, `RefCell`, global state, I/O, or unsafe
/// code.
/// It is a logic error for an item to be modified in such a way that the
/// transformation of the item to or from a `usize`, as determined by the
/// `CLike` trait, changes while the item is in the set. This is normally only
/// possible through `Cell`, `RefCell`, global state, I/O, or unsafe code.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct EnumSet<E> {
// We must maintain the invariant that no bits are set
// for which no variant exists
@ -93,22 +98,16 @@ fn bit<E:CLike>(e: &E) -> usize {
impl<E:CLike> EnumSet<E> {
/// Returns an empty `EnumSet`.
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn new() -> EnumSet<E> {
EnumSet {bits: 0, marker: marker::PhantomData}
}
/// Returns the number of elements in the given `EnumSet`.
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn len(&self) -> usize {
self.bits.count_ones() as usize
}
/// Returns true if the `EnumSet` is empty.
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn is_empty(&self) -> bool {
self.bits == 0
}
@ -118,22 +117,16 @@ impl<E:CLike> EnumSet<E> {
}
/// Returns `false` if the `EnumSet` contains any enum of the given `EnumSet`.
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn is_disjoint(&self, other: &EnumSet<E>) -> bool {
(self.bits & other.bits) == 0
}
/// Returns `true` if a given `EnumSet` is included in this `EnumSet`.
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn is_superset(&self, other: &EnumSet<E>) -> bool {
(self.bits & other.bits) == other.bits
}
/// Returns `true` if this `EnumSet` is included in the given `EnumSet`.
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn is_subset(&self, other: &EnumSet<E>) -> bool {
other.is_superset(self)
}
@ -151,8 +144,6 @@ impl<E:CLike> EnumSet<E> {
}
/// Adds an enum to the `EnumSet`, and returns `true` if it wasn't there before
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn insert(&mut self, e: E) -> bool {
let result = !self.contains(&e);
self.bits |= bit(&e);
@ -160,8 +151,6 @@ impl<E:CLike> EnumSet<E> {
}
/// Removes an enum from the EnumSet
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn remove(&mut self, e: &E) -> bool {
let result = self.contains(e);
self.bits &= !bit(e);
@ -169,15 +158,11 @@ impl<E:CLike> EnumSet<E> {
}
/// Returns `true` if an `EnumSet` contains a given enum.
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn contains(&self, e: &E) -> bool {
(self.bits & bit(e)) != 0
}
/// Returns an iterator over an `EnumSet`.
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn iter(&self) -> Iter<E> {
Iter::new(self.bits)
}

View File

@ -10,14 +10,17 @@
//! Collection types.
//!
//! See [std::collections](../std/collections) for a detailed discussion of collections in Rust.
//! See [std::collections](../std/collections) for a detailed discussion of
//! collections in Rust.
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
#![cfg_attr(stage0, feature(custom_attribute))]
#![crate_name = "collections"]
#![unstable(feature = "collections")]
#![staged_api]
#![crate_type = "rlib"]
#![unstable(feature = "collections",
reason = "library is unlikely to be stabilized with the current \
layout and name, use std::collections instead")]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/",
@ -107,14 +110,12 @@ pub mod vec;
pub mod vec_deque;
pub mod vec_map;
#[unstable(feature = "collections",
reason = "RFC 509")]
#[unstable(feature = "bitvec", reason = "RFC 509")]
pub mod bit_vec {
pub use bit::{BitVec, Iter};
}
#[unstable(feature = "collections",
reason = "RFC 509")]
#[unstable(feature = "bitset", reason = "RFC 509")]
pub mod bit_set {
pub use bit::{BitSet, Union, Intersection, Difference, SymmetricDifference};
pub use bit::SetIter as Iter;
@ -133,6 +134,7 @@ pub mod btree_set {
// FIXME(#14344) this shouldn't be necessary
#[doc(hidden)]
#[unstable(feature = "issue_14344_fixme")]
pub fn fixme_14344_be_sure_to_link_to_collections() {}
#[cfg(not(test))]
@ -141,6 +143,7 @@ mod std {
}
/// An endpoint of a range of keys.
#[unstable(feature = "collections_bound")]
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
pub enum Bound<T> {
/// An inclusive bound.

View File

@ -801,7 +801,7 @@ impl<'a, A> IterMut<'a, A> {
/// }
/// ```
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "linked_list_extras",
reason = "this is probably better handled by a cursor type -- we'll see")]
pub fn insert_next(&mut self, elt: A) {
self.insert_next_node(box Node::new(elt))
@ -824,7 +824,7 @@ impl<'a, A> IterMut<'a, A> {
/// assert_eq!(it.next().unwrap(), &2);
/// ```
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "linked_list_extras",
reason = "this is probably better handled by a cursor type -- we'll see")]
pub fn peek_next(&mut self) -> Option<&mut A> {
if self.nelem == 0 {

View File

@ -7,6 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![unstable(feature = "collections_range", reason = "was just added")]
//! Range syntax.

View File

@ -11,7 +11,8 @@
//! Utilities for slice manipulation
//!
//! The `slice` module contains useful code to help work with slice values.
//! Slices are a view into a block of memory represented as a pointer and a length.
//! Slices are a view into a block of memory represented as a pointer and a
//! length.
//!
//! ```
//! // slicing a Vec
@ -69,8 +70,9 @@
//! }
//! ```
//!
//! This iterator yields mutable references to the slice's elements, so while the element
//! type of the slice is `i32`, the element type of the iterator is `&mut i32`.
//! This iterator yields mutable references to the slice's elements, so while
//! the element type of the slice is `i32`, the element type of the iterator is
//! `&mut i32`.
//!
//! * `.iter()` and `.iter_mut()` are the explicit methods to return the default
//! iterators.
@ -278,14 +280,14 @@ impl<T> [T] {
}
/// Returns all but the first element of a slice.
#[unstable(feature = "collections", reason = "likely to be renamed")]
#[unstable(feature = "slice_extras", reason = "likely to be renamed")]
#[inline]
pub fn tail(&self) -> &[T] {
core_slice::SliceExt::tail(self)
}
/// Returns all but the first element of a mutable slice
#[unstable(feature = "collections",
#[unstable(feature = "slice_extras",
reason = "likely to be renamed or removed")]
#[inline]
pub fn tail_mut(&mut self) -> &mut [T] {
@ -293,14 +295,14 @@ impl<T> [T] {
}
/// Returns all but the last element of a slice.
#[unstable(feature = "collections", reason = "likely to be renamed")]
#[unstable(feature = "slice_extras", reason = "likely to be renamed")]
#[inline]
pub fn init(&self) -> &[T] {
core_slice::SliceExt::init(self)
}
/// Returns all but the last element of a mutable slice
#[unstable(feature = "collections",
#[unstable(feature = "slice_extras",
reason = "likely to be renamed or removed")]
#[inline]
pub fn init_mut(&mut self) -> &mut [T] {
@ -727,13 +729,13 @@ impl<T> [T] {
}
/// Find the first index containing a matching value.
#[unstable(feature = "collections")]
#[unstable(feature = "slice_position_elem")]
pub fn position_elem(&self, t: &T) -> Option<usize> where T: PartialEq {
core_slice::SliceExt::position_elem(self, t)
}
/// Find the last index containing a matching value.
#[unstable(feature = "collections")]
#[unstable(feature = "slice_position_elem")]
pub fn rposition_elem(&self, t: &T) -> Option<usize> where T: PartialEq {
core_slice::SliceExt::rposition_elem(self, t)
}
@ -869,7 +871,7 @@ impl<T> [T] {
/// assert_eq!(Some(vec![1, 3, 2]), perms.next());
/// assert_eq!(Some(vec![3, 1, 2]), perms.next());
/// ```
#[unstable(feature = "collections")]
#[unstable(feature = "permutations")]
#[inline]
pub fn permutations(&self) -> Permutations<T> where T: Clone {
// NB see hack module in this file
@ -893,7 +895,7 @@ impl<T> [T] {
/// let b: &mut [_] = &mut [1, 0, 2];
/// assert!(v == b);
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "permutations",
reason = "uncertain if this merits inclusion in std")]
pub fn next_permutation(&mut self) -> bool where T: Ord {
core_slice::SliceExt::next_permutation(self)
@ -916,7 +918,7 @@ impl<T> [T] {
/// let b: &mut [_] = &mut [0, 1, 2];
/// assert!(v == b);
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "permutations",
reason = "uncertain if this merits inclusion in std")]
pub fn prev_permutation(&mut self) -> bool where T: Ord {
core_slice::SliceExt::prev_permutation(self)
@ -940,7 +942,7 @@ impl<T> [T] {
/// assert!(dst.clone_from_slice(&src2) == 3);
/// assert!(dst == [3, 4, 5]);
/// ```
#[unstable(feature = "collections")]
#[unstable(feature = "clone_from_slice")]
pub fn clone_from_slice(&mut self, src: &[T]) -> usize where T: Clone {
core_slice::SliceExt::clone_from_slice(self, src)
}
@ -967,7 +969,7 @@ impl<T> [T] {
/// assert_eq!(num_moved, 3);
/// assert!(a == [6, 7, 8, 4, 5]);
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "move_from",
reason = "uncertain about this API approach")]
#[inline]
pub fn move_from(&mut self, mut src: Vec<T>, start: usize, end: usize) -> usize {
@ -997,10 +999,12 @@ impl<T> [T] {
////////////////////////////////////////////////////////////////////////////////
// Extension traits for slices over specific kinds of data
////////////////////////////////////////////////////////////////////////////////
#[unstable(feature = "collections", reason = "recently changed")]
#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist")]
/// An extension trait for concatenating slices
pub trait SliceConcatExt<T: ?Sized> {
#[unstable(feature = "collections", reason = "recently changed")]
#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist")]
/// The resulting type after concatenation
type Output;
@ -1014,8 +1018,8 @@ pub trait SliceConcatExt<T: ?Sized> {
#[stable(feature = "rust1", since = "1.0.0")]
fn concat(&self) -> Self::Output;
/// Flattens a slice of `T` into a single value `Self::Output`, placing a given separator
/// between each.
/// Flattens a slice of `T` into a single value `Self::Output`, placing a
/// given separator between each.
///
/// # Examples
///
@ -1060,7 +1064,7 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V] {
///
/// The last generated swap is always (0, 1), and it returns the
/// sequence to its initial order.
#[unstable(feature = "collections")]
#[unstable(feature = "permutations")]
#[derive(Clone)]
pub struct ElementSwaps {
sdir: Vec<SizeDirection>,
@ -1072,7 +1076,7 @@ pub struct ElementSwaps {
impl ElementSwaps {
/// Creates an `ElementSwaps` iterator for a sequence of `length` elements.
#[unstable(feature = "collections")]
#[unstable(feature = "permutations")]
pub fn new(length: usize) -> ElementSwaps {
// Initialize `sdir` with a direction that position should move in
// (all negative at the beginning) and the `size` of the
@ -1194,13 +1198,13 @@ impl Iterator for ElementSwaps {
/// swap applied.
///
/// Generates even and odd permutations alternately.
#[unstable(feature = "collections")]
#[unstable(feature = "permutations")]
pub struct Permutations<T> {
swaps: ElementSwaps,
v: Vec<T>,
}
#[unstable(feature = "collections", reason = "trait is unstable")]
#[unstable(feature = "permutations", reason = "trait is unstable")]
impl<T: Clone> Iterator for Permutations<T> {
type Item = Vec<T>;

View File

@ -366,7 +366,7 @@ impl<'a> Iterator for Recompositions<'a> {
///
/// For use with the `std::iter` module.
#[derive(Clone)]
#[unstable(feature = "collections")]
#[unstable(feature = "str_utf16")]
pub struct Utf16Units<'a> {
encoder: Utf16Encoder<Chars<'a>>
}
@ -591,7 +591,7 @@ impl str {
/// assert_eq!(s.slice_chars(0, 4), "Löwe");
/// assert_eq!(s.slice_chars(5, 7), "老虎");
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "slice_chars",
reason = "may have yet to prove its worth")]
pub fn slice_chars(&self, begin: usize, end: usize) -> &str {
core_str::StrExt::slice_chars(self, begin, end)
@ -1068,7 +1068,7 @@ impl str {
}
/// Returns an iterator of `u16` over the string encoded as UTF-16.
#[unstable(feature = "collections",
#[unstable(feature = "str_utf16",
reason = "this functionality may only be provided by libunicode")]
pub fn utf16_units(&self) -> Utf16Units {
Utf16Units { encoder: Utf16Encoder::new(self[..].chars()) }
@ -1527,7 +1527,7 @@ impl str {
/// let v: Vec<&str> = "1abc2abc3".matches(char::is_numeric).collect();
/// assert_eq!(v, ["1", "2", "3"]);
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "str_matches",
reason = "method got recently added")]
pub fn matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> Matches<'a, P> {
core_str::StrExt::matches(self, pat)
@ -1560,7 +1560,7 @@ impl str {
/// let v: Vec<&str> = "1abc2abc3".rmatches(char::is_numeric).collect();
/// assert_eq!(v, ["3", "2", "1"]);
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "str_matches",
reason = "method got recently added")]
pub fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P>
where P::Searcher: ReverseSearcher<'a>
@ -1605,7 +1605,7 @@ impl str {
/// let v: Vec<(usize, usize)> = "ababa".match_indices("aba").collect();
/// assert_eq!(v, [(0, 3)]); // only the first `aba`
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "str_matches",
reason = "might have its iterator type changed")]
// NB: Right now MatchIndices yields `(usize, usize)`, but it would
// be more consistent with `matches` and `char_indices` to return `(usize, &str)`
@ -1649,7 +1649,7 @@ impl str {
/// let v: Vec<(usize, usize)> = "ababa".rmatch_indices("aba").collect();
/// assert_eq!(v, [(2, 5)]); // only the last `aba`
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "str_matches",
reason = "might have its iterator type changed")]
// NB: Right now RMatchIndices yields `(usize, usize)`, but it would
// be more consistent with `rmatches` and `char_indices` to return `(usize, &str)`
@ -1677,7 +1677,7 @@ impl str {
/// assert!(string.subslice_offset(lines[1]) == 2); // &"b"
/// assert!(string.subslice_offset(lines[2]) == 4); // &"c"
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "subslice_offset",
reason = "awaiting convention about comparability of arbitrary slices")]
pub fn subslice_offset(&self, inner: &str) -> usize {
core_str::StrExt::subslice_offset(self, inner)
@ -1922,14 +1922,14 @@ impl str {
}
/// Escapes each char in `s` with `char::escape_default`.
#[unstable(feature = "collections",
#[unstable(feature = "str_escape",
reason = "return type may change to be an iterator")]
pub fn escape_default(&self) -> String {
self.chars().flat_map(|c| c.escape_default()).collect()
}
/// Escapes each char in `s` with `char::escape_unicode`.
#[unstable(feature = "collections",
#[unstable(feature = "str_escape",
reason = "return type may change to be an iterator")]
pub fn escape_unicode(&self) -> String {
self.chars().flat_map(|c| c.escape_unicode()).collect()

View File

@ -696,7 +696,7 @@ impl String {
/// # Examples
///
/// ```
/// # #![feature(collections_drain)]
/// # #![feature(drain)]
///
/// let mut s = String::from("α is alpha, β is beta");
/// let beta_offset = s.find('β').unwrap_or(s.len());
@ -710,7 +710,7 @@ impl String {
/// s.drain(..);
/// assert_eq!(s, "");
/// ```
#[unstable(feature = "collections_drain",
#[unstable(feature = "drain",
reason = "recently added, matches RFC")]
pub fn drain<R>(&mut self, range: R) -> Drain where R: RangeArgument<usize> {
// Memory safety
@ -975,10 +975,14 @@ impl ops::Deref for String {
/// Wrapper type providing a `&String` reference via `Deref`.
#[unstable(feature = "collections")]
#[deprecated(since = "1.2.0",
reason = "replaced with deref coercions or Borrow")]
#[allow(deprecated)]
pub struct DerefString<'a> {
x: DerefVec<'a, u8>
}
#[allow(deprecated)]
impl<'a> Deref for DerefString<'a> {
type Target = String;
@ -1005,6 +1009,9 @@ impl<'a> Deref for DerefString<'a> {
/// string_consumer(&as_string("foo"));
/// ```
#[unstable(feature = "collections")]
#[deprecated(since = "1.2.0",
reason = "replaced with deref coercions or Borrow")]
#[allow(deprecated)]
pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {
DerefString { x: as_vec(x.as_bytes()) }
}
@ -1134,7 +1141,7 @@ impl fmt::Write for String {
}
/// A draining iterator for `String`.
#[unstable(feature = "collections_drain", reason = "recently added")]
#[unstable(feature = "drain", reason = "recently added")]
pub struct Drain<'a> {
/// Will be used as &'a mut String in the destructor
string: *mut String,
@ -1149,7 +1156,7 @@ pub struct Drain<'a> {
unsafe impl<'a> Sync for Drain<'a> {}
unsafe impl<'a> Send for Drain<'a> {}
#[unstable(feature = "collections_drain", reason = "recently added")]
#[unstable(feature = "drain", reason = "recently added")]
impl<'a> Drop for Drain<'a> {
fn drop(&mut self) {
unsafe {
@ -1163,7 +1170,7 @@ impl<'a> Drop for Drain<'a> {
}
}
#[unstable(feature = "collections_drain", reason = "recently added")]
#[unstable(feature = "drain", reason = "recently added")]
impl<'a> Iterator for Drain<'a> {
type Item = char;
@ -1177,7 +1184,7 @@ impl<'a> Iterator for Drain<'a> {
}
}
#[unstable(feature = "collections_drain", reason = "recently added")]
#[unstable(feature = "drain", reason = "recently added")]
impl<'a> DoubleEndedIterator for Drain<'a> {
#[inline]
fn next_back(&mut self) -> Option<char> {

View File

@ -276,7 +276,7 @@ impl<T> Vec<T> {
/// the buffer are copied into the vector without cloning, as if
/// `ptr::read()` were called on them.
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "vec_from_raw_buf",
reason = "may be better expressed via composition")]
pub unsafe fn from_raw_buf(ptr: *const T, elts: usize) -> Vec<T> {
let mut dst = Vec::with_capacity(elts);
@ -704,7 +704,7 @@ impl<T> Vec<T> {
/// assert_eq!(vec2, []);
/// ```
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "append",
reason = "new API, waiting for dust to settle")]
pub fn append(&mut self, other: &mut Self) {
if mem::size_of::<T>() == 0 {
@ -742,7 +742,7 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(collections_drain)]
/// # #![feature(drain)]
///
/// // Draining using `..` clears the whole vector.
/// let mut v = vec![1, 2, 3];
@ -750,7 +750,7 @@ impl<T> Vec<T> {
/// assert_eq!(v, &[]);
/// assert_eq!(u, &[1, 2, 3]);
/// ```
#[unstable(feature = "collections_drain",
#[unstable(feature = "drain",
reason = "recently added, matches RFC")]
pub fn drain<R>(&mut self, range: R) -> Drain<T> where R: RangeArgument<usize> {
// Memory safety
@ -851,7 +851,7 @@ impl<T> Vec<T> {
/// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x));
/// assert_eq!(&newtyped_bytes[..], &[Newtype(0x11), Newtype(0x22)]);
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "map_in_place",
reason = "API may change to provide stronger guarantees")]
pub fn map_in_place<U, F>(self, mut f: F) -> Vec<U> where F: FnMut(T) -> U {
// FIXME: Assert statically that the types `T` and `U` have the same
@ -1043,14 +1043,14 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// # #![feature(split_off)]
/// let mut vec = vec![1,2,3];
/// let vec2 = vec.split_off(1);
/// assert_eq!(vec, [1]);
/// assert_eq!(vec2, [2, 3]);
/// ```
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "split_off",
reason = "new API, waiting for dust to settle")]
pub fn split_off(&mut self, at: usize) -> Self {
assert!(at <= self.len(), "`at` out of bounds");
@ -1091,7 +1091,7 @@ impl<T: Clone> Vec<T> {
/// vec.resize(2, 0);
/// assert_eq!(vec, [1, 2]);
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "vec_resize",
reason = "matches collection reform specification; waiting for dust to settle")]
pub fn resize(&mut self, new_len: usize, value: T) {
let len = self.len();
@ -1117,7 +1117,7 @@ impl<T: Clone> Vec<T> {
/// assert_eq!(vec, [1, 2, 3, 4]);
/// ```
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "vec_push_all",
reason = "likely to be replaced by a more optimized extend")]
pub fn push_all(&mut self, other: &[T]) {
self.reserve(other.len());
@ -1738,7 +1738,7 @@ unsafe impl<T: Sync> Sync for IntoIter<T> { }
impl<T> IntoIter<T> {
#[inline]
/// Drops all items that have not yet been moved and returns the empty vector.
#[unstable(feature = "collections")]
#[unstable(feature = "iter_to_vec")]
pub fn into_inner(mut self) -> Vec<T> {
unsafe {
for _x in self.by_ref() { }
@ -1832,7 +1832,7 @@ impl<T> Drop for IntoIter<T> {
}
/// A draining iterator for `Vec<T>`.
#[unstable(feature = "collections_drain", reason = "recently added")]
#[unstable(feature = "drain", reason = "recently added")]
pub struct Drain<'a, T: 'a> {
/// Index of tail to preserve
tail_start: usize,
@ -1907,12 +1907,17 @@ impl<'a, T> ExactSizeIterator for Drain<'a, T> {}
/// Wrapper type providing a `&Vec<T>` reference via `Deref`.
#[unstable(feature = "collections")]
#[deprecated(since = "1.2.0",
reason = "replaced with deref coercions or Borrow")]
pub struct DerefVec<'a, T:'a> {
x: Vec<T>,
l: PhantomData<&'a T>,
}
#[unstable(feature = "collections")]
#[deprecated(since = "1.2.0",
reason = "replaced with deref coercions or Borrow")]
#[allow(deprecated)]
impl<'a, T> Deref for DerefVec<'a, T> {
type Target = Vec<T>;
@ -1923,6 +1928,9 @@ impl<'a, T> Deref for DerefVec<'a, T> {
// Prevent the inner `Vec<T>` from attempting to deallocate memory.
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "1.2.0",
reason = "replaced with deref coercions or Borrow")]
#[allow(deprecated)]
impl<'a, T> Drop for DerefVec<'a, T> {
fn drop(&mut self) {
self.x.len = 0;
@ -1948,6 +1956,9 @@ impl<'a, T> Drop for DerefVec<'a, T> {
/// vec_consumer(&as_vec(&values));
/// ```
#[unstable(feature = "collections")]
#[deprecated(since = "1.2.0",
reason = "replaced with deref coercions or Borrow")]
#[allow(deprecated)]
pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> {
unsafe {
DerefVec {

View File

@ -491,7 +491,7 @@ impl<T> VecDeque<T> {
/// assert_eq!(buf.len(), 1);
/// assert_eq!(Some(&5), buf.get(0));
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "deque_extras",
reason = "matches collection reform specification; waiting on panic semantics")]
pub fn truncate(&mut self, len: usize) {
for _ in len..self.len() {
@ -552,7 +552,7 @@ impl<T> VecDeque<T> {
/// Returns a pair of slices which contain, in order, the contents of the
/// `VecDeque`.
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "deque_extras",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn as_slices(&self) -> (&[T], &[T]) {
unsafe {
@ -572,7 +572,7 @@ impl<T> VecDeque<T> {
/// Returns a pair of slices which contain, in order, the contents of the
/// `VecDeque`.
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "deque_extras",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T]) {
unsafe {
@ -638,7 +638,7 @@ impl<T> VecDeque<T> {
/// assert!(v.is_empty());
/// ```
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "drain",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn drain(&mut self) -> Drain<T> {
Drain {
@ -880,7 +880,7 @@ impl<T> VecDeque<T> {
/// buf.push_back(10);
/// assert_eq!(buf.swap_back_remove(1), Some(99));
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "deque_extras",
reason = "the naming of this function may be altered")]
pub fn swap_back_remove(&mut self, index: usize) -> Option<T> {
let length = self.len();
@ -914,7 +914,7 @@ impl<T> VecDeque<T> {
/// buf.push_back(20);
/// assert_eq!(buf.swap_front_remove(3), Some(99));
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "deque_extras",
reason = "the naming of this function may be altered")]
pub fn swap_front_remove(&mut self, index: usize) -> Option<T> {
let length = self.len();
@ -1320,7 +1320,7 @@ impl<T> VecDeque<T> {
/// assert_eq!(buf2.len(), 2);
/// ```
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "split_off",
reason = "new API, waiting for dust to settle")]
pub fn split_off(&mut self, at: usize) -> Self {
let len = self.len();
@ -1383,7 +1383,7 @@ impl<T> VecDeque<T> {
/// assert_eq!(buf2.len(), 0);
/// ```
#[inline]
#[unstable(feature = "collections",
#[unstable(feature = "append",
reason = "new API, waiting for dust to settle")]
pub fn append(&mut self, other: &mut Self) {
// naive impl
@ -1447,7 +1447,7 @@ impl<T: Clone> VecDeque<T> {
/// assert_eq!(a, b);
/// }
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "deque_extras",
reason = "matches collection reform specification; waiting on panic semantics")]
pub fn resize(&mut self, new_len: usize, value: T) {
let len = self.len();
@ -1635,7 +1635,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
impl<T> ExactSizeIterator for IntoIter<T> {}
/// A draining VecDeque iterator
#[unstable(feature = "collections",
#[unstable(feature = "drain",
reason = "matches collection reform specification, waiting for dust to settle")]
pub struct Drain<'a, T: 'a> {
inner: &'a mut VecDeque<T>,

View File

@ -12,6 +12,8 @@
//! are O(highest integer key).
#![allow(missing_docs)]
#![unstable(feature = "vecmap",
reason = "may not be stabilized in the standard library")]
use self::Entry::*;
@ -325,7 +327,7 @@ impl<V> VecMap<V> {
/// assert_eq!(a[3], "c");
/// assert_eq!(a[4], "d");
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "append",
reason = "recently added as part of collections reform 2")]
pub fn append(&mut self, other: &mut Self) {
self.extend(other.drain());
@ -358,7 +360,7 @@ impl<V> VecMap<V> {
/// assert_eq!(b[3], "c");
/// assert_eq!(b[4], "d");
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "split_off",
reason = "recently added as part of collections reform 2")]
pub fn split_off(&mut self, at: usize) -> Self {
let mut other = VecMap::new();
@ -410,7 +412,7 @@ impl<V> VecMap<V> {
///
/// assert_eq!(vec, [(1, "a"), (2, "b"), (3, "c")]);
/// ```
#[unstable(feature = "collections",
#[unstable(feature = "drain",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn drain<'a>(&'a mut self) -> Drain<'a, V> {
fn filter<A>((i, v): (usize, Option<A>)) -> Option<(usize, A)> {
@ -632,7 +634,7 @@ impl<V> VecMap<V> {
impl<'a, V> Entry<'a, V> {
#[unstable(feature = "collections",
#[unstable(feature = "entry",
reason = "will soon be replaced by or_insert")]
#[deprecated(since = "1.0",
reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")]
@ -644,7 +646,7 @@ impl<'a, V> Entry<'a, V> {
}
}
#[unstable(feature = "collections",
#[unstable(feature = "entry",
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
/// a mutable reference to the value in the entry.
@ -655,7 +657,7 @@ impl<'a, V> Entry<'a, V> {
}
}
#[unstable(feature = "collections",
#[unstable(feature = "entry",
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,
/// and returns a mutable reference to the value in the entry.
@ -1003,14 +1005,14 @@ pub struct IntoIter<V> {
fn((usize, Option<V>)) -> Option<(usize, V)>>
}
#[unstable(feature = "collections")]
#[unstable(feature = "drain")]
pub struct Drain<'a, V:'a> {
iter: FilterMap<
Enumerate<vec::Drain<'a, Option<V>>>,
fn((usize, Option<V>)) -> Option<(usize, V)>>
}
#[unstable(feature = "collections")]
#[unstable(feature = "drain")]
impl<'a, V> Iterator for Drain<'a, V> {
type Item = (usize, V);
@ -1018,7 +1020,7 @@ impl<'a, V> Iterator for Drain<'a, V> {
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}
#[unstable(feature = "collections")]
#[unstable(feature = "drain")]
impl<'a, V> DoubleEndedIterator for Drain<'a, V> {
fn next_back(&mut self) -> Option<(usize, V)> { self.iter.next_back() }
}

View File

@ -281,8 +281,9 @@
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(collections)]
#![feature(into_cow)]
#![feature(str_escape)]
use self::LabelText::*;

View File

@ -25,18 +25,22 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(append)]
#![feature(associated_consts)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(clone_from_slice)]
#![feature(collections)]
#![feature(const_fn)]
#![feature(duration)]
#![feature(duration_span)]
#![feature(enumset)]
#![feature(fs_canonicalize)]
#![feature(hash_default)]
#![feature(into_cow)]
#![feature(iter_sum)]
#![feature(libc)]
#![feature(map_in_place)]
#![feature(num_bits_bytes)]
#![feature(path_ext)]
#![feature(quote)]
@ -45,10 +49,14 @@
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(slice_bytes)]
#![feature(slice_extras)]
#![feature(slice_patterns)]
#![feature(slice_position_elem)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(str_char)]
#![feature(str_matches)]
#![feature(vec_push_all)]
#![feature(wrapping)]
#![cfg_attr(test, feature(test))]

View File

@ -33,7 +33,6 @@
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(fs_canonicalize)]
#![feature(libc)]
#![feature(path_ext)]
@ -42,6 +41,7 @@
#![feature(slice_bytes)]
#![feature(staged_api)]
#![feature(step_by)]
#![feature(vec_push_all)]
#![cfg_attr(test, feature(test, rand))]
extern crate syntax;

View File

@ -26,14 +26,15 @@
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(exit_status)]
#![feature(libc)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(exit_status)]
#![feature(set_stdio)]
#![feature(staged_api)]
#![feature(str_casing)]
#![feature(vec_push_all)]
extern crate arena;
extern crate flate;

View File

@ -30,17 +30,17 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![cfg_attr(test, feature(test))]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(num_bits_bytes)]
#![feature(quote)]
#![feature(ref_slice)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(str_casing)]
#![feature(str_char)]
#![cfg_attr(test, feature(test))]
extern crate syntax;
#[macro_use]

View File

@ -27,10 +27,10 @@
#![feature(associated_consts)]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(libc)]
#![feature(link_args)]
#![feature(staged_api)]
#![feature(vec_push_all)]
extern crate libc;
#[macro_use] #[no_link] extern crate rustc_bitflags;

View File

@ -20,10 +20,10 @@
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(associated_consts)]
#![feature(collections)]
#![feature(rc_weak)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(slice_extras)]
#![feature(staged_api)]
#[macro_use] extern crate log;

View File

@ -27,7 +27,6 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(const_fn)]
#![feature(fs)]
#![feature(iter_cmp)]
@ -46,6 +45,7 @@
#![feature(std_misc)]
#![feature(unicode)]
#![feature(unicode)]
#![feature(vec_push_all)]
#![allow(trivial_casts)]

View File

@ -77,14 +77,16 @@ This API is completely unstable and subject to change.
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(collections, collections_drain)]
#![feature(drain)]
#![feature(iter_cmp)]
#![feature(iter_sum)]
#![feature(quote)]
#![feature(ref_slice)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(slice_extras)]
#![feature(staged_api)]
#![feature(vec_push_all)]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;

View File

@ -310,7 +310,9 @@ impl char {
#[unstable(feature = "unicode",
reason = "pending decision about Iterator/Writer/Reader")]
#[inline]
pub fn encode_utf8(self, dst: &mut [u8]) -> Option<usize> { C::encode_utf8(self, dst) }
pub fn encode_utf8(self, dst: &mut [u8]) -> Option<usize> {
C::encode_utf8(self, dst)
}
/// Encodes this character as UTF-16 into the provided `u16` buffer, and
/// then returns the number of `u16`s written.
@ -345,7 +347,9 @@ impl char {
#[unstable(feature = "unicode",
reason = "pending decision about Iterator/Writer/Reader")]
#[inline]
pub fn encode_utf16(self, dst: &mut [u16]) -> Option<usize> { C::encode_utf16(self, dst) }
pub fn encode_utf16(self, dst: &mut [u16]) -> Option<usize> {
C::encode_utf16(self, dst)
}
/// Returns whether the specified character is considered a Unicode
/// alphabetic code point.
@ -541,5 +545,7 @@ impl char {
#[unstable(feature = "unicode",
reason = "needs expert opinion. is_cjk flag stands out as ugly")]
#[inline]
pub fn width(self, is_cjk: bool) -> Option<usize> { charwidth::width(self, is_cjk) }
pub fn width(self, is_cjk: bool) -> Option<usize> {
charwidth::width(self, is_cjk)
}
}

View File

@ -36,6 +36,8 @@ Core encoding and decoding interfaces.
#![feature(std_misc)]
#![feature(str_char)]
#![feature(unicode)]
#![feature(vecmap)]
#![feature(enumset)]
#![cfg_attr(test, feature(test))]
// test harness access

View File

@ -110,7 +110,9 @@
#![feature(box_raw)]
#![feature(box_syntax)]
#![feature(char_internals)]
#![feature(clone_from_slice)]
#![feature(collections)]
#![feature(collections_bound)]
#![feature(const_fn)]
#![feature(core)]
#![feature(core_float)]
@ -126,6 +128,8 @@
#![feature(libc)]
#![feature(linkage, thread_local, asm)]
#![feature(macro_reexport)]
#![feature(slice_concat_ext)]
#![feature(slice_position_elem)]
#![feature(no_std)]
#![feature(num_bits_bytes)]
#![feature(oom)]
@ -142,6 +146,7 @@
#![feature(unicode)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![feature(vec_push_all)]
#![feature(wrapping)]
#![feature(zero_one)]
#![cfg_attr(test, feature(float_from_str_radix))]

View File

@ -26,15 +26,17 @@
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(associated_consts)]
#![feature(collections)]
#![feature(collections_drain)]
#![feature(bitset)]
#![feature(drain)]
#![feature(filling_drop)]
#![feature(libc)]
#![feature(ref_slice)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(str_char)]
#![feature(str_escape)]
#![feature(unicode)]
#![feature(vec_push_all)]
extern crate fmt_macros;
extern crate serialize;

View File

@ -56,12 +56,12 @@
#![deny(missing_docs)]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(path_ext)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(str_char)]
#![feature(path_ext)]
#![feature(vec_push_all)]
#![cfg_attr(windows, feature(libc))]
#[macro_use] extern crate log;

View File

@ -36,7 +36,6 @@
#![feature(asm)]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(duration)]
#![feature(duration_span)]
#![feature(fnbox)]
@ -44,6 +43,7 @@
#![feature(libc)]
#![feature(rustc_private)]
#![feature(set_stdio)]
#![feature(slice_extras)]
#![feature(staged_api)]
#![feature(std_misc)]

View File

@ -10,11 +10,11 @@
#![deny(warnings)]
#![feature(core)]
#![feature(exit_status)]
#![feature(rustdoc)]
#![feature(rustc_private)]
#![feature(iter_sum)]
#![feature(path_relative_from)]
#![feature(rustc_private)]
#![feature(rustdoc)]
extern crate rustdoc;
extern crate rustc_back;