grandfathered -> rust1
This commit is contained in:
parent
b7fe2c54b7
commit
b44ee371b8
102 changed files with 1490 additions and 1490 deletions
|
|
@ -69,7 +69,7 @@
|
|||
//! }
|
||||
//! ```
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use mem::transmute;
|
||||
use option::Option::{self, Some, None};
|
||||
|
|
@ -86,7 +86,7 @@ use intrinsics;
|
|||
///
|
||||
/// Every type with no non-`'static` references implements `Any`, so `Any` can
|
||||
/// be used as a trait object to emulate the effects dynamic typing.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Any: 'static {
|
||||
/// Get the `TypeId` of `self`
|
||||
#[unstable(feature = "core",
|
||||
|
|
@ -104,7 +104,7 @@ impl<T: 'static> Any for T {
|
|||
|
||||
impl Any {
|
||||
/// Returns true if the boxed type is the same as `T`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn is<T: 'static>(&self) -> bool {
|
||||
// Get TypeId of the type this function is instantiated with
|
||||
|
|
@ -119,7 +119,7 @@ impl Any {
|
|||
|
||||
/// Returns some reference to the boxed value if it is of type `T`, or
|
||||
/// `None` if it isn't.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn downcast_ref<T: 'static>(&self) -> Option<&T> {
|
||||
if self.is::<T>() {
|
||||
|
|
@ -137,7 +137,7 @@ impl Any {
|
|||
|
||||
/// Returns some mutable reference to the boxed value if it is of type `T`, or
|
||||
/// `None` if it isn't.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> {
|
||||
if self.is::<T>() {
|
||||
|
|
@ -168,7 +168,7 @@ impl Any {
|
|||
/// but this limitation may be removed in the future.
|
||||
#[cfg_attr(stage0, lang = "type_id")]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Show, Hash)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct TypeId {
|
||||
t: u64,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use option::Option;
|
|||
macro_rules! array_impls {
|
||||
($($N:expr)+) => {
|
||||
$(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T:Copy> Clone for [T; $N] {
|
||||
fn clone(&self) -> [T; $N] {
|
||||
*self
|
||||
|
|
@ -47,7 +47,7 @@ macro_rules! array_impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &[B; $N]) -> bool {
|
||||
|
|
@ -59,7 +59,7 @@ macro_rules! array_impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A, B, Rhs> PartialEq<Rhs> for [A; $N] where
|
||||
A: PartialEq<B>,
|
||||
Rhs: Deref<Target=[B]>,
|
||||
|
|
@ -74,7 +74,7 @@ macro_rules! array_impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where
|
||||
A: PartialEq<B>,
|
||||
Lhs: Deref<Target=[A]>
|
||||
|
|
@ -89,10 +89,10 @@ macro_rules! array_impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T:Eq> Eq for [T; $N] { }
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T:PartialOrd> PartialOrd for [T; $N] {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> {
|
||||
|
|
@ -116,7 +116,7 @@ macro_rules! array_impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T:Ord> Ord for [T; $N] {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &[T; $N]) -> Ordering {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
//! println!("live tasks: {}", old_task_count + 1);
|
||||
//! ```
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use self::Ordering::*;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ use intrinsics;
|
|||
use cell::UnsafeCell;
|
||||
|
||||
/// A boolean type which can be safely shared between threads.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct AtomicBool {
|
||||
v: UnsafeCell<usize>,
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ pub struct AtomicBool {
|
|||
unsafe impl Sync for AtomicBool {}
|
||||
|
||||
/// A signed integer type which can be safely shared between threads.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct AtomicIsize {
|
||||
v: UnsafeCell<isize>,
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ pub struct AtomicIsize {
|
|||
unsafe impl Sync for AtomicIsize {}
|
||||
|
||||
/// An unsigned integer type which can be safely shared between threads.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct AtomicUsize {
|
||||
v: UnsafeCell<usize>,
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ pub struct AtomicUsize {
|
|||
unsafe impl Sync for AtomicUsize {}
|
||||
|
||||
/// A raw pointer type which can be safely shared between threads.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct AtomicPtr<T> {
|
||||
p: UnsafeCell<usize>,
|
||||
}
|
||||
|
|
@ -119,42 +119,42 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
|
|||
///
|
||||
/// Rust's memory orderings are [the same as
|
||||
/// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync).
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Copy)]
|
||||
pub enum Ordering {
|
||||
/// No ordering constraints, only atomic operations.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Relaxed,
|
||||
/// When coupled with a store, all previous writes become visible
|
||||
/// to another thread that performs a load with `Acquire` ordering
|
||||
/// on the same value.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Release,
|
||||
/// When coupled with a load, all subsequent loads will see data
|
||||
/// written before a store with `Release` ordering on the same value
|
||||
/// in another thread.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Acquire,
|
||||
/// When coupled with a load, uses `Acquire` ordering, and with a store
|
||||
/// `Release` ordering.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
AcqRel,
|
||||
/// Like `AcqRel` with the additional guarantee that all threads see all
|
||||
/// sequentially consistent operations in the same order.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
SeqCst,
|
||||
}
|
||||
|
||||
/// An `AtomicBool` initialized to `false`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const ATOMIC_BOOL_INIT: AtomicBool =
|
||||
AtomicBool { v: UnsafeCell { value: 0 } };
|
||||
/// An `AtomicIsize` initialized to `0`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const ATOMIC_ISIZE_INIT: AtomicIsize =
|
||||
AtomicIsize { v: UnsafeCell { value: 0 } };
|
||||
/// An `AtomicUsize` initialized to `0`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const ATOMIC_USIZE_INIT: AtomicUsize =
|
||||
AtomicUsize { v: UnsafeCell { value: 0, } };
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ impl AtomicBool {
|
|||
/// let atomic_false = AtomicBool::new(false);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new(v: bool) -> AtomicBool {
|
||||
let val = if v { UINT_TRUE } else { 0 };
|
||||
AtomicBool { v: UnsafeCell::new(val) }
|
||||
|
|
@ -197,7 +197,7 @@ impl AtomicBool {
|
|||
/// let value = some_bool.load(Ordering::Relaxed);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn load(&self, order: Ordering) -> bool {
|
||||
unsafe { atomic_load(self.v.get(), order) > 0 }
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ impl AtomicBool {
|
|||
///
|
||||
/// Panics if `order` is `Acquire` or `AcqRel`.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn store(&self, val: bool, order: Ordering) {
|
||||
let val = if val { UINT_TRUE } else { 0 };
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ impl AtomicBool {
|
|||
/// let value = some_bool.swap(false, Ordering::Relaxed);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn swap(&self, val: bool, order: Ordering) -> bool {
|
||||
let val = if val { UINT_TRUE } else { 0 };
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ impl AtomicBool {
|
|||
/// let value = some_bool.store(false, Ordering::Relaxed);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn compare_and_swap(&self, old: bool, new: bool, order: Ordering) -> bool {
|
||||
let old = if old { UINT_TRUE } else { 0 };
|
||||
let new = if new { UINT_TRUE } else { 0 };
|
||||
|
|
@ -298,7 +298,7 @@ impl AtomicBool {
|
|||
/// assert_eq!(false, foo.load(Ordering::SeqCst));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn fetch_and(&self, val: bool, order: Ordering) -> bool {
|
||||
let val = if val { UINT_TRUE } else { 0 };
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ impl AtomicBool {
|
|||
/// assert_eq!(true, foo.load(Ordering::SeqCst));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn fetch_nand(&self, val: bool, order: Ordering) -> bool {
|
||||
let val = if val { UINT_TRUE } else { 0 };
|
||||
|
||||
|
|
@ -363,7 +363,7 @@ impl AtomicBool {
|
|||
/// assert_eq!(false, foo.load(Ordering::SeqCst));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn fetch_or(&self, val: bool, order: Ordering) -> bool {
|
||||
let val = if val { UINT_TRUE } else { 0 };
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ impl AtomicBool {
|
|||
/// assert_eq!(false, foo.load(Ordering::SeqCst));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn fetch_xor(&self, val: bool, order: Ordering) -> bool {
|
||||
let val = if val { UINT_TRUE } else { 0 };
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ impl AtomicBool {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl AtomicIsize {
|
||||
/// Creates a new `AtomicIsize`.
|
||||
///
|
||||
|
|
@ -580,7 +580,7 @@ impl AtomicIsize {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl AtomicUsize {
|
||||
/// Creates a new `AtomicUsize`.
|
||||
///
|
||||
|
|
@ -769,7 +769,7 @@ impl<T> AtomicPtr<T> {
|
|||
/// let atomic_ptr = AtomicPtr::new(ptr);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new(p: *mut T) -> AtomicPtr<T> {
|
||||
AtomicPtr { p: UnsafeCell::new(p as usize) }
|
||||
}
|
||||
|
|
@ -793,7 +793,7 @@ impl<T> AtomicPtr<T> {
|
|||
/// let value = some_ptr.load(Ordering::Relaxed);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn load(&self, order: Ordering) -> *mut T {
|
||||
unsafe {
|
||||
atomic_load(self.p.get(), order) as *mut T
|
||||
|
|
@ -821,7 +821,7 @@ impl<T> AtomicPtr<T> {
|
|||
///
|
||||
/// Panics if `order` is `Acquire` or `AcqRel`.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn store(&self, ptr: *mut T, order: Ordering) {
|
||||
unsafe { atomic_store(self.p.get(), ptr as usize, order); }
|
||||
}
|
||||
|
|
@ -843,7 +843,7 @@ impl<T> AtomicPtr<T> {
|
|||
/// let value = some_ptr.swap(other_ptr, Ordering::Relaxed);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T {
|
||||
unsafe { atomic_swap(self.p.get(), ptr as usize, order) as *mut T }
|
||||
}
|
||||
|
|
@ -869,7 +869,7 @@ impl<T> AtomicPtr<T> {
|
|||
/// let value = some_ptr.compare_and_swap(other_ptr, another_ptr, Ordering::Relaxed);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn compare_and_swap(&self, old: *mut T, new: *mut T, order: Ordering) -> *mut T {
|
||||
unsafe {
|
||||
atomic_compare_and_swap(self.p.get(), old as usize,
|
||||
|
|
@ -890,7 +890,7 @@ unsafe fn atomic_store<T>(dst: *mut T, val: T, order:Ordering) {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_load_acq(dst),
|
||||
|
|
@ -902,7 +902,7 @@ unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_xchg_acq(dst, val),
|
||||
|
|
@ -915,7 +915,7 @@ unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
|||
|
||||
/// Returns the old value (like __sync_fetch_and_add).
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_xadd_acq(dst, val),
|
||||
|
|
@ -928,7 +928,7 @@ unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
|||
|
||||
/// Returns the old value (like __sync_fetch_and_sub).
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_xsub_acq(dst, val),
|
||||
|
|
@ -940,7 +940,7 @@ unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_compare_and_swap<T>(dst: *mut T, old:T, new:T, order: Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_cxchg_acq(dst, old, new),
|
||||
|
|
@ -952,7 +952,7 @@ unsafe fn atomic_compare_and_swap<T>(dst: *mut T, old:T, new:T, order: Ordering)
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_and_acq(dst, val),
|
||||
|
|
@ -964,7 +964,7 @@ unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_nand<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_nand_acq(dst, val),
|
||||
|
|
@ -977,7 +977,7 @@ unsafe fn atomic_nand<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
|||
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_or<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_or_acq(dst, val),
|
||||
|
|
@ -990,7 +990,7 @@ unsafe fn atomic_or<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
|||
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_xor_acq(dst, val),
|
||||
|
|
@ -1023,7 +1023,7 @@ unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
|
|||
///
|
||||
/// Panics if `order` is `Relaxed`.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn fence(order: Ordering) {
|
||||
unsafe {
|
||||
match order {
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> {
|
|||
Owned(T)
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> {
|
||||
fn clone(&self) -> Cow<'a, T, B> {
|
||||
match *self {
|
||||
|
|
@ -197,7 +197,7 @@ impl<'a, T, B: ?Sized> Cow<'a, T, B> where B: ToOwned<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> {
|
||||
type Target = B;
|
||||
|
||||
|
|
@ -209,10 +209,10 @@ impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, B: ?Sized> Eq for Cow<'a, T, B> where B: Eq + ToOwned<T> {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &Cow<'a, T, B>) -> Ordering {
|
||||
|
|
@ -220,7 +220,7 @@ impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, 'b, T, U, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B> where
|
||||
B: PartialEq<C> + ToOwned<T>,
|
||||
C: ToOwned<U>,
|
||||
|
|
@ -231,7 +231,7 @@ impl<'a, 'b, T, U, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, U, C>> for Cow<'a, T,
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwned<T> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Cow<'a, T, B>) -> Option<Ordering> {
|
||||
|
|
@ -239,7 +239,7 @@ impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwne
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, B: ?Sized> fmt::String for Cow<'a, T, B> where
|
||||
B: fmt::String + ToOwned<T>,
|
||||
T: fmt::String,
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@
|
|||
// FIXME: Can't be shared between threads. Dynamic borrows
|
||||
// FIXME: Relationship to Atomic types and RWLock
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use clone::Clone;
|
||||
use cmp::PartialEq;
|
||||
|
|
@ -165,14 +165,14 @@ use option::Option;
|
|||
use option::Option::{None, Some};
|
||||
|
||||
/// A mutable memory location that admits only `Copy` data.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Cell<T> {
|
||||
value: UnsafeCell<T>,
|
||||
}
|
||||
|
||||
impl<T:Copy> Cell<T> {
|
||||
/// Creates a new `Cell` containing the given value.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new(value: T) -> Cell<T> {
|
||||
Cell {
|
||||
value: UnsafeCell::new(value),
|
||||
|
|
@ -181,14 +181,14 @@ impl<T:Copy> Cell<T> {
|
|||
|
||||
/// Returns a copy of the contained value.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn get(&self) -> T {
|
||||
unsafe{ *self.value.get() }
|
||||
}
|
||||
|
||||
/// Sets the contained value.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn set(&self, value: T) {
|
||||
unsafe {
|
||||
*self.value.get() = value;
|
||||
|
|
@ -207,25 +207,25 @@ impl<T:Copy> Cell<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe impl<T> Send for Cell<T> where T: Send {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T:Copy> Clone for Cell<T> {
|
||||
fn clone(&self) -> Cell<T> {
|
||||
Cell::new(self.get())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T:Default + Copy> Default for Cell<T> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn default() -> Cell<T> {
|
||||
Cell::new(Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T:PartialEq + Copy> PartialEq for Cell<T> {
|
||||
fn eq(&self, other: &Cell<T>) -> bool {
|
||||
self.get() == other.get()
|
||||
|
|
@ -233,7 +233,7 @@ impl<T:PartialEq + Copy> PartialEq for Cell<T> {
|
|||
}
|
||||
|
||||
/// A mutable memory location with dynamically checked borrow rules
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct RefCell<T> {
|
||||
value: UnsafeCell<T>,
|
||||
borrow: Cell<BorrowFlag>,
|
||||
|
|
@ -247,7 +247,7 @@ const WRITING: BorrowFlag = -1;
|
|||
|
||||
impl<T> RefCell<T> {
|
||||
/// Create a new `RefCell` containing `value`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new(value: T) -> RefCell<T> {
|
||||
RefCell {
|
||||
value: UnsafeCell::new(value),
|
||||
|
|
@ -256,7 +256,7 @@ impl<T> RefCell<T> {
|
|||
}
|
||||
|
||||
/// Consumes the `RefCell`, returning the wrapped value.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn into_inner(self) -> T {
|
||||
// Since this function takes `self` (the `RefCell`) by value, the
|
||||
// compiler statically verifies that it is not currently borrowed.
|
||||
|
|
@ -287,7 +287,7 @@ impl<T> RefCell<T> {
|
|||
/// # Panics
|
||||
///
|
||||
/// Panics if the value is currently mutably borrowed.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
|
||||
match self.try_borrow() {
|
||||
Some(ptr) => ptr,
|
||||
|
|
@ -317,7 +317,7 @@ impl<T> RefCell<T> {
|
|||
/// # Panics
|
||||
///
|
||||
/// Panics if the value is currently borrowed.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
|
||||
match self.try_borrow_mut() {
|
||||
Some(ptr) => ptr,
|
||||
|
|
@ -337,25 +337,25 @@ impl<T> RefCell<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe impl<T> Send for RefCell<T> where T: Send {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Clone> Clone for RefCell<T> {
|
||||
fn clone(&self) -> RefCell<T> {
|
||||
RefCell::new(self.borrow().clone())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T:Default> Default for RefCell<T> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn default() -> RefCell<T> {
|
||||
RefCell::new(Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: PartialEq> PartialEq for RefCell<T> {
|
||||
fn eq(&self, other: &RefCell<T>) -> bool {
|
||||
*self.borrow() == *other.borrow()
|
||||
|
|
@ -399,7 +399,7 @@ impl<'b> Clone for BorrowRef<'b> {
|
|||
}
|
||||
|
||||
/// Wraps a borrowed reference to a value in a `RefCell` box.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Ref<'b, T:'b> {
|
||||
// FIXME #12808: strange name to try to avoid interfering with
|
||||
// field accesses of the contained type via Deref
|
||||
|
|
@ -407,7 +407,7 @@ pub struct Ref<'b, T:'b> {
|
|||
_borrow: BorrowRef<'b>,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'b, T> Deref for Ref<'b, T> {
|
||||
type Target = T;
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ impl<'b> BorrowRefMut<'b> {
|
|||
}
|
||||
|
||||
/// Wraps a mutable borrowed reference to a value in a `RefCell` box.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct RefMut<'b, T:'b> {
|
||||
// FIXME #12808: strange name to try to avoid interfering with
|
||||
// field accesses of the contained type via Deref
|
||||
|
|
@ -466,7 +466,7 @@ pub struct RefMut<'b, T:'b> {
|
|||
_borrow: BorrowRefMut<'b>,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'b, T> Deref for RefMut<'b, T> {
|
||||
type Target = T;
|
||||
|
||||
|
|
@ -476,7 +476,7 @@ impl<'b, T> Deref for RefMut<'b, T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'b, T> DerefMut for RefMut<'b, T> {
|
||||
#[inline]
|
||||
fn deref_mut<'a>(&'a mut self) -> &'a mut T {
|
||||
|
|
@ -522,7 +522,7 @@ impl<'b, T> DerefMut for RefMut<'b, T> {
|
|||
/// is not recommended to access its fields directly, `get` should be used
|
||||
/// instead.
|
||||
#[lang="unsafe"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct UnsafeCell<T> {
|
||||
/// Wrapped value
|
||||
///
|
||||
|
|
@ -538,14 +538,14 @@ impl<T> UnsafeCell<T> {
|
|||
///
|
||||
/// All access to the inner value through methods is `unsafe`, and it is
|
||||
/// highly discouraged to access the fields directly.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new(value: T) -> UnsafeCell<T> {
|
||||
UnsafeCell { value: value }
|
||||
}
|
||||
|
||||
/// Gets a mutable pointer to the wrapped value.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn get(&self) -> *mut T { &self.value as *const T as *mut T }
|
||||
|
||||
/// Unwraps the value
|
||||
|
|
@ -553,6 +553,6 @@ impl<T> UnsafeCell<T> {
|
|||
/// This function is unsafe because there is no guarantee that this or other
|
||||
/// tasks are currently inspecting the inner value.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn into_inner(self) -> T { self.value }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,12 +64,12 @@ static MAX_THREE_B: u32 = 0x10000u32;
|
|||
*/
|
||||
|
||||
/// The highest valid code point
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MAX: char = '\u{10ffff}';
|
||||
|
||||
/// Converts from `u32` to a `char`
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn from_u32(i: u32) -> Option<char> {
|
||||
// catch out-of-bounds and surrogates
|
||||
if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
|
||||
|
|
@ -111,7 +111,7 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
|
|||
}
|
||||
|
||||
/// Basic `char` manipulations.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait CharExt {
|
||||
/// Checks if a `char` parses as a numeric digit in the given radix.
|
||||
///
|
||||
|
|
@ -151,7 +151,7 @@ pub trait CharExt {
|
|||
/// All characters are escaped with Rust syntax of the form `\\u{NNNN}`
|
||||
/// where `NNNN` is the shortest hexadecimal representation of the code
|
||||
/// point.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn escape_unicode(self) -> EscapeUnicode;
|
||||
|
||||
/// Returns an iterator that yields the 'default' ASCII and
|
||||
|
|
@ -166,17 +166,17 @@ pub trait CharExt {
|
|||
/// escaped.
|
||||
/// * Any other chars in the range [0x20,0x7e] are not escaped.
|
||||
/// * Any other chars are given hex Unicode escapes; see `escape_unicode`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn escape_default(self) -> EscapeDefault;
|
||||
|
||||
/// Returns the amount of bytes this character would need if encoded in
|
||||
/// UTF-8.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn len_utf8(self) -> uint;
|
||||
|
||||
/// Returns the amount of bytes this character would need if encoded in
|
||||
/// UTF-16.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn len_utf16(self) -> uint;
|
||||
|
||||
/// Encodes this character as UTF-8 into the provided byte buffer,
|
||||
|
|
@ -184,7 +184,7 @@ pub trait CharExt {
|
|||
///
|
||||
/// If the buffer is not large enough, nothing will be written into it
|
||||
/// and a `None` will be returned.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn encode_utf8(self, dst: &mut [u8]) -> Option<uint>;
|
||||
|
||||
/// Encodes this character as UTF-16 into the provided `u16` buffer,
|
||||
|
|
@ -192,11 +192,11 @@ pub trait CharExt {
|
|||
///
|
||||
/// If the buffer is not large enough, nothing will be written into it
|
||||
/// and a `None` will be returned.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn encode_utf16(self, dst: &mut [u16]) -> Option<uint>;
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl CharExt for char {
|
||||
#[unstable(feature = "core",
|
||||
reason = "pending integer conventions")]
|
||||
|
|
@ -220,12 +220,12 @@ impl CharExt for char {
|
|||
else { None }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn escape_unicode(self) -> EscapeUnicode {
|
||||
EscapeUnicode { c: self, state: EscapeUnicodeState::Backslash }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn escape_default(self) -> EscapeDefault {
|
||||
let init_state = match self {
|
||||
'\t' => EscapeDefaultState::Backslash('t'),
|
||||
|
|
@ -241,7 +241,7 @@ impl CharExt for char {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn len_utf8(self) -> uint {
|
||||
let code = self as u32;
|
||||
match () {
|
||||
|
|
@ -253,7 +253,7 @@ impl CharExt for char {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn len_utf16(self) -> uint {
|
||||
let ch = self as u32;
|
||||
if (ch & 0xFFFF_u32) == ch { 1 } else { 2 }
|
||||
|
|
@ -313,7 +313,7 @@ impl CharExt for char {
|
|||
/// An iterator over the characters that represent a `char`, as escaped by
|
||||
/// Rust's unicode escaping rules.
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct EscapeUnicode {
|
||||
c: char,
|
||||
state: EscapeUnicodeState
|
||||
|
|
@ -330,7 +330,7 @@ enum EscapeUnicodeState {
|
|||
Done,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Iterator for EscapeUnicode {
|
||||
type Item = char;
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ impl Iterator for EscapeUnicode {
|
|||
/// An iterator over the characters that represent a `char`, escaped
|
||||
/// for maximum portability.
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct EscapeDefault {
|
||||
state: EscapeDefaultState
|
||||
}
|
||||
|
|
@ -390,7 +390,7 @@ enum EscapeDefaultState {
|
|||
Unicode(EscapeUnicode),
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Iterator for EscapeDefault {
|
||||
type Item = char;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@
|
|||
//! explicitly, by convention implementing the `Clone` trait and calling
|
||||
//! the `clone` method.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use marker::Sized;
|
||||
|
||||
/// A common trait for cloning an object.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Clone : Sized {
|
||||
/// Returns a copy of the value.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn clone(&self) -> Self;
|
||||
|
||||
/// Perform copy-assignment from `source`.
|
||||
|
|
@ -43,7 +43,7 @@ pub trait Clone : Sized {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T: ?Sized> Clone for &'a T {
|
||||
/// Return a shallow copy of the reference.
|
||||
#[inline]
|
||||
|
|
@ -52,7 +52,7 @@ impl<'a, T: ?Sized> Clone for &'a T {
|
|||
|
||||
macro_rules! clone_impl {
|
||||
($t:ty) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Clone for $t {
|
||||
/// Return a deep copy of the value.
|
||||
#[inline]
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
|
||||
//! ```
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use self::Ordering::*;
|
||||
|
||||
|
|
@ -68,16 +68,16 @@ use option::Option::{self, Some, None};
|
|||
/// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and
|
||||
/// only if `a != b`.
|
||||
#[lang="eq"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[old_orphan_check]
|
||||
pub trait PartialEq<Rhs: ?Sized = Self> {
|
||||
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn eq(&self, other: &Rhs) -> bool;
|
||||
|
||||
/// This method tests for `!=`.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn ne(&self, other: &Rhs) -> bool { !self.eq(other) }
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
|
|||
/// - reflexive: `a == a`;
|
||||
/// - symmetric: `a == b` implies `b == a`; and
|
||||
/// - transitive: `a == b` and `b == c` implies `a == c`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Eq: PartialEq<Self> {
|
||||
// FIXME #13101: this method is used solely by #[deriving] to
|
||||
// assert that every component of a type implements #[deriving]
|
||||
|
|
@ -106,16 +106,16 @@ pub trait Eq: PartialEq<Self> {
|
|||
|
||||
/// An ordering is, e.g, a result of a comparison between two values.
|
||||
#[derive(Clone, Copy, PartialEq, Show)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub enum Ordering {
|
||||
/// An ordering where a compared value is less [than another].
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Less = -1i,
|
||||
/// An ordering where a compared value is equal [to another].
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Equal = 0i,
|
||||
/// An ordering where a compared value is greater [than another].
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Greater = 1i,
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ impl Ordering {
|
|||
/// assert!(data == b);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn reverse(self) -> Ordering {
|
||||
unsafe {
|
||||
// this compiles really nicely (to a single instruction);
|
||||
|
|
@ -164,7 +164,7 @@ impl Ordering {
|
|||
/// true; and
|
||||
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
|
||||
/// both `==` and `>`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Ord: Eq + PartialOrd<Self> {
|
||||
/// This method returns an ordering between `self` and `other` values.
|
||||
///
|
||||
|
|
@ -178,26 +178,26 @@ pub trait Ord: Eq + PartialOrd<Self> {
|
|||
/// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5
|
||||
/// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn cmp(&self, other: &Self) -> Ordering;
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Eq for Ordering {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Ord for Ordering {
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn cmp(&self, other: &Ordering) -> Ordering {
|
||||
(*self as int).cmp(&(*other as int))
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialOrd for Ordering {
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> {
|
||||
(*self as int).partial_cmp(&(*other as int))
|
||||
}
|
||||
|
|
@ -224,16 +224,16 @@ impl PartialOrd for Ordering {
|
|||
/// `NaN < 0 == false` and `NaN >= 0 == false` (cf. IEEE 754-2008 section
|
||||
/// 5.11).
|
||||
#[lang="ord"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
|
||||
/// This method returns an ordering between `self` and `other` values
|
||||
/// if one exists.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
|
||||
|
||||
/// This method tests less than (for `self` and `other`) and is used by the `<` operator.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn lt(&self, other: &Rhs) -> bool {
|
||||
match self.partial_cmp(other) {
|
||||
Some(Less) => true,
|
||||
|
|
@ -243,7 +243,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
|
|||
|
||||
/// This method tests less than or equal to (`<=`).
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn le(&self, other: &Rhs) -> bool {
|
||||
match self.partial_cmp(other) {
|
||||
Some(Less) | Some(Equal) => true,
|
||||
|
|
@ -253,7 +253,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
|
|||
|
||||
/// This method tests greater than (`>`).
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn gt(&self, other: &Rhs) -> bool {
|
||||
match self.partial_cmp(other) {
|
||||
Some(Greater) => true,
|
||||
|
|
@ -263,7 +263,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
|
|||
|
||||
/// This method tests greater than or equal to (`>=`).
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn ge(&self, other: &Rhs) -> bool {
|
||||
match self.partial_cmp(other) {
|
||||
Some(Greater) | Some(Equal) => true,
|
||||
|
|
@ -274,14 +274,14 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
|
|||
|
||||
/// Compare and return the minimum of two values.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn min<T: Ord>(v1: T, v2: T) -> T {
|
||||
if v1 < v2 { v1 } else { v2 }
|
||||
}
|
||||
|
||||
/// Compare and return the maximum of two values.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn max<T: Ord>(v1: T, v2: T) -> T {
|
||||
if v1 > v2 { v1 } else { v2 }
|
||||
}
|
||||
|
|
@ -322,7 +322,7 @@ mod impls {
|
|||
|
||||
macro_rules! partial_eq_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialEq for $t {
|
||||
#[inline]
|
||||
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
|
||||
|
|
@ -332,7 +332,7 @@ mod impls {
|
|||
)*)
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialEq for () {
|
||||
#[inline]
|
||||
fn eq(&self, _other: &()) -> bool { true }
|
||||
|
|
@ -346,7 +346,7 @@ mod impls {
|
|||
|
||||
macro_rules! eq_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Eq for $t {}
|
||||
)*)
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ mod impls {
|
|||
|
||||
macro_rules! partial_ord_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialOrd for $t {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &$t) -> Option<Ordering> {
|
||||
|
|
@ -378,7 +378,7 @@ mod impls {
|
|||
)*)
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialOrd for () {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, _: &()) -> Option<Ordering> {
|
||||
|
|
@ -386,7 +386,7 @@ mod impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialOrd for bool {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &bool) -> Option<Ordering> {
|
||||
|
|
@ -398,7 +398,7 @@ mod impls {
|
|||
|
||||
macro_rules! ord_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Ord for $t {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &$t) -> Ordering {
|
||||
|
|
@ -410,13 +410,13 @@ mod impls {
|
|||
)*)
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Ord for () {
|
||||
#[inline]
|
||||
fn cmp(&self, _other: &()) -> Ordering { Equal }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Ord for bool {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &bool) -> Ordering {
|
||||
|
|
@ -428,14 +428,14 @@ mod impls {
|
|||
|
||||
// & pointers
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a A where A: PartialEq<B> {
|
||||
#[inline]
|
||||
fn eq(&self, other: & &'b B) -> bool { PartialEq::eq(*self, *other) }
|
||||
#[inline]
|
||||
fn ne(&self, other: & &'b B) -> bool { PartialEq::ne(*self, *other) }
|
||||
}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b B> for &'a A where A: PartialOrd<B> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &&'b B) -> Option<Ordering> {
|
||||
|
|
@ -450,24 +450,24 @@ mod impls {
|
|||
#[inline]
|
||||
fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) }
|
||||
}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A: ?Sized> Ord for &'a A where A: Ord {
|
||||
#[inline]
|
||||
fn cmp(&self, other: & &'a A) -> Ordering { Ord::cmp(*self, *other) }
|
||||
}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A: ?Sized> Eq for &'a A where A: Eq {}
|
||||
|
||||
// &mut pointers
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a mut A where A: PartialEq<B> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) }
|
||||
#[inline]
|
||||
fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) }
|
||||
}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b mut B> for &'a mut A where A: PartialOrd<B> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &&'b mut B) -> Option<Ordering> {
|
||||
|
|
@ -482,15 +482,15 @@ mod impls {
|
|||
#[inline]
|
||||
fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) }
|
||||
}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A: ?Sized> Ord for &'a mut A where A: Ord {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &&'a mut A) -> Ordering { Ord::cmp(*self, *other) }
|
||||
}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A: ?Sized> Eq for &'a mut A where A: Eq {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a A where A: PartialEq<B> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) }
|
||||
|
|
@ -498,7 +498,7 @@ mod impls {
|
|||
fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a mut A where A: PartialEq<B> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &&'b B) -> bool { PartialEq::eq(*self, *other) }
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
//! }
|
||||
//! ```
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
/// A trait that types which have a useful default value should implement.
|
||||
///
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
/// bar: f32,
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Default {
|
||||
/// Returns the "default value" for a type.
|
||||
///
|
||||
|
|
@ -131,16 +131,16 @@ pub trait Default {
|
|||
/// fn default() -> Kind { Kind::A }
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn default() -> Self;
|
||||
}
|
||||
|
||||
macro_rules! default_impl {
|
||||
($t:ty, $v:expr) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Default for $t {
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn default() -> $t { $v }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
//! Utilities for formatting and printing strings
|
||||
|
||||
#![allow(unused_variables)]
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use any;
|
||||
use cell::{Cell, RefCell, Ref, RefMut};
|
||||
|
|
@ -207,7 +207,7 @@ impl<'a> Arguments<'a> {
|
|||
/// and pass it to a function or closure, passed as the first argument. The
|
||||
/// macro validates the format string at compile-time so usage of the `write`
|
||||
/// and `format` functions can be safely performed.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Copy)]
|
||||
pub struct Arguments<'a> {
|
||||
// Format string pieces to print.
|
||||
|
|
@ -227,7 +227,7 @@ impl<'a> Show for Arguments<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> String for Arguments<'a> {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||
write(fmt.buf, *self)
|
||||
|
|
@ -653,7 +653,7 @@ impl Show for bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl String for bool {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
String::fmt(if *self { "true" } else { "false" }, f)
|
||||
|
|
@ -670,7 +670,7 @@ impl Show for str {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl String for str {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
f.pad(self)
|
||||
|
|
@ -688,7 +688,7 @@ impl Show for char {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl String for char {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
let mut utf8 = [0u8; 4];
|
||||
|
|
@ -734,7 +734,7 @@ macro_rules! floating { ($ty:ident) => {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl String for $ty {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||
use num::Float;
|
||||
|
|
@ -901,7 +901,7 @@ impl<'b, T: Show> Show for RefMut<'b, T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl String for Utf8Error {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
match *self {
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ extern "rust-intrinsic" {
|
|||
///
|
||||
/// `forget` is unsafe because the caller is responsible for
|
||||
/// ensuring the argument is deallocated already.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn forget<T>(_: T) -> ();
|
||||
|
||||
/// Unsafely transforms a value of one type into a value of another type.
|
||||
|
|
@ -243,7 +243,7 @@ extern "rust-intrinsic" {
|
|||
/// let v: &[u8] = unsafe { mem::transmute("L") };
|
||||
/// assert!(v == [76u8]);
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn transmute<T,U>(e: T) -> U;
|
||||
|
||||
/// Gives the address for the return value of the enclosing function.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
//!
|
||||
//! This `for` loop syntax can be applied to any iterator over any type.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use self::MinMaxResult::*;
|
||||
|
||||
|
|
@ -81,13 +81,13 @@ use uint;
|
|||
/// it wishes, either by returning `None` infinitely, or by doing something
|
||||
/// else.
|
||||
#[lang="iterator"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Iterator {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Item;
|
||||
|
||||
/// Advance the iterator and return the next value. Return `None` when the end is reached.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn next(&mut self) -> Option<Self::Item>;
|
||||
|
||||
/// Returns a lower and upper bound on the remaining length of the iterator.
|
||||
|
|
@ -95,12 +95,12 @@ pub trait Iterator {
|
|||
/// An upper bound of `None` means either there is no known upper bound, or the upper bound
|
||||
/// does not fit within a `uint`.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
|
||||
}
|
||||
|
||||
/// Conversion from an `Iterator`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
|
||||
built from an iterator over elements of type `{A}`"]
|
||||
pub trait FromIterator<A> {
|
||||
|
|
@ -109,15 +109,15 @@ pub trait FromIterator<A> {
|
|||
}
|
||||
|
||||
/// A type growable from an `Iterator` implementation
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Extend<A> {
|
||||
/// Extend a container with the elements yielded by an arbitrary iterator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn extend<T: Iterator<Item=A>>(&mut self, iterator: T);
|
||||
}
|
||||
|
||||
/// An extension trait providing numerous methods applicable to all iterators.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait IteratorExt: Iterator + Sized {
|
||||
/// Counts the number of elements in this iterator.
|
||||
///
|
||||
|
|
@ -129,7 +129,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.count() == 5);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn count(self) -> uint {
|
||||
self.fold(0, |cnt, _x| cnt + 1)
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(a.iter().last().unwrap() == &5);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn last(mut self) -> Option<Self::Item> {
|
||||
let mut last = None;
|
||||
for x in self { last = Some(x); }
|
||||
|
|
@ -163,7 +163,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.nth(2) == None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn nth(&mut self, mut n: uint) -> Option<Self::Item> {
|
||||
for x in *self {
|
||||
if n == 0 { return Some(x) }
|
||||
|
|
@ -187,7 +187,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn chain<U>(self, other: U) -> Chain<Self, U> where
|
||||
U: Iterator<Item=Self::Item>,
|
||||
{
|
||||
|
|
@ -210,7 +210,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn zip<B, U>(self, other: U) -> Zip<Self, U> where
|
||||
U: Iterator<Item=B>,
|
||||
{
|
||||
|
|
@ -230,7 +230,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn map<B, F>(self, f: F) -> Map<Self::Item, B, Self, F> where
|
||||
F: FnMut(Self::Item) -> B,
|
||||
{
|
||||
|
|
@ -250,7 +250,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn filter<P>(self, predicate: P) -> Filter<Self::Item, Self, P> where
|
||||
P: FnMut(&Self::Item) -> bool,
|
||||
{
|
||||
|
|
@ -270,7 +270,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn filter_map<B, F>(self, f: F) -> FilterMap<Self::Item, B, Self, F> where
|
||||
F: FnMut(Self::Item) -> Option<B>,
|
||||
{
|
||||
|
|
@ -291,7 +291,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn enumerate(self) -> Enumerate<Self> {
|
||||
Enumerate{iter: self, count: 0}
|
||||
}
|
||||
|
|
@ -314,7 +314,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn peekable(self) -> Peekable<Self::Item, Self> {
|
||||
Peekable{iter: self, peeked: None}
|
||||
}
|
||||
|
|
@ -334,7 +334,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self::Item, Self, P> where
|
||||
P: FnMut(&Self::Item) -> bool,
|
||||
{
|
||||
|
|
@ -355,7 +355,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn take_while<P>(self, predicate: P) -> TakeWhile<Self::Item, Self, P> where
|
||||
P: FnMut(&Self::Item) -> bool,
|
||||
{
|
||||
|
|
@ -375,7 +375,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn skip(self, n: uint) -> Skip<Self> {
|
||||
Skip{iter: self, n: n}
|
||||
}
|
||||
|
|
@ -394,7 +394,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn take(self, n: uint) -> Take<Self> {
|
||||
Take{iter: self, n: n}
|
||||
}
|
||||
|
|
@ -420,7 +420,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(it.next().is_none());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn scan<St, B, F>(
|
||||
self,
|
||||
initial_state: St,
|
||||
|
|
@ -450,7 +450,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// }
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn flat_map<B, U, F>(self, f: F) -> FlatMap<Self::Item, B, Self, U, F> where
|
||||
U: Iterator<Item=B>,
|
||||
F: FnMut(Self::Item) -> U,
|
||||
|
|
@ -486,7 +486,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert_eq!(process(x.into_iter()), 1006);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn fuse(self) -> Fuse<Self> {
|
||||
Fuse{iter: self, done: false}
|
||||
}
|
||||
|
|
@ -510,7 +510,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// println!("{}", sum);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn inspect<F>(self, f: F) -> Inspect<Self::Item, Self, F> where
|
||||
F: FnMut(&Self::Item),
|
||||
{
|
||||
|
|
@ -532,7 +532,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// // xs.next() is now `5`
|
||||
/// assert!(xs.next() == Some(5));
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn by_ref<'r>(&'r mut self) -> ByRef<'r, Self> {
|
||||
ByRef{iter: self}
|
||||
}
|
||||
|
|
@ -548,7 +548,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(a.as_slice() == b.as_slice());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn collect<B: FromIterator<Self::Item>>(self) -> B {
|
||||
FromIterator::from_iter(self)
|
||||
}
|
||||
|
|
@ -594,7 +594,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(a.iter().fold(0, |a, &b| a + b) == 15);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn fold<B, F>(mut self, init: B, mut f: F) -> B where
|
||||
F: FnMut(B, Self::Item) -> B,
|
||||
{
|
||||
|
|
@ -615,7 +615,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(!a.iter().all(|x| *x > 2));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn all<F>(mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
|
||||
for x in self { if !f(x) { return false; } }
|
||||
true
|
||||
|
|
@ -633,7 +633,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(!it.any(|x| *x == 3));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
|
||||
for x in *self { if f(x) { return true; } }
|
||||
false
|
||||
|
|
@ -643,7 +643,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
///
|
||||
/// Does not consume the iterator past the first found element.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
|
||||
P: FnMut(&Self::Item) -> bool,
|
||||
{
|
||||
|
|
@ -655,7 +655,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
|
||||
/// Return the index of the first element satisfying the specified predicate
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn position<P>(&mut self, mut predicate: P) -> Option<uint> where
|
||||
P: FnMut(Self::Item) -> bool,
|
||||
{
|
||||
|
|
@ -673,7 +673,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
///
|
||||
/// If no element matches, None is returned.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn rposition<P>(&mut self, mut predicate: P) -> Option<uint> where
|
||||
P: FnMut(Self::Item) -> bool,
|
||||
Self: ExactSizeIterator + DoubleEndedIterator
|
||||
|
|
@ -696,7 +696,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(a.iter().max().unwrap() == &5);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn max(self) -> Option<Self::Item> where Self::Item: Ord
|
||||
{
|
||||
self.fold(None, |max, x| {
|
||||
|
|
@ -716,7 +716,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert!(a.iter().min().unwrap() == &1);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn min(self) -> Option<Self::Item> where Self::Item: Ord
|
||||
{
|
||||
self.fold(None, |min, x| {
|
||||
|
|
@ -878,7 +878,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// Note: Random access with flipped indices still only applies to the first
|
||||
/// `uint::MAX` elements of the original iterator.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn rev(self) -> Rev<Self> {
|
||||
Rev{iter: self}
|
||||
}
|
||||
|
|
@ -941,7 +941,7 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// assert_eq!(cy.next(), Some(1));
|
||||
/// assert_eq!(cy.next(), Some(1));
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn cycle(self) -> Cycle<Self> where Self: Clone {
|
||||
Cycle{orig: self.clone(), iter: self}
|
||||
|
|
@ -962,17 +962,17 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> IteratorExt for I where I: Iterator {}
|
||||
|
||||
/// A range iterator able to yield elements from both ends
|
||||
///
|
||||
/// A `DoubleEndedIterator` can be thought of as a deque in that `next()` and `next_back()` exhaust
|
||||
/// elements from the *same* range, and do not work independently of each other.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait DoubleEndedIterator: Iterator {
|
||||
/// Yield an element from the end of the range, returning `None` if the range is empty.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn next_back(&mut self) -> Option<Self::Item>;
|
||||
}
|
||||
|
||||
|
|
@ -1000,7 +1000,7 @@ pub trait RandomAccessIterator: Iterator {
|
|||
///
|
||||
/// `Iterator::size_hint` *must* return the exact size of the iterator.
|
||||
/// Note that the size must fit in `uint`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait ExactSizeIterator: Iterator {
|
||||
#[inline]
|
||||
/// Return the exact length of the iterator.
|
||||
|
|
@ -1017,32 +1017,32 @@ pub trait ExactSizeIterator: Iterator {
|
|||
|
||||
// All adaptors that preserve the size of the wrapped iterator are fine
|
||||
// Adaptors that may overflow in `size_hint` are not, i.e. `Chain`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> ExactSizeIterator for Enumerate<I> where I: ExactSizeIterator {}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, F> ExactSizeIterator for Inspect<A, I, F> where
|
||||
I: ExactSizeIterator<Item=A>,
|
||||
F: FnMut(&A),
|
||||
{}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> ExactSizeIterator for Rev<I> where I: ExactSizeIterator + DoubleEndedIterator {}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, F> ExactSizeIterator for Map<A, B, I, F> where
|
||||
I: ExactSizeIterator<Item=A>,
|
||||
F: FnMut(A) -> B,
|
||||
{}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B> ExactSizeIterator for Zip<A, B> where A: ExactSizeIterator, B: ExactSizeIterator {}
|
||||
|
||||
/// An double-ended iterator with the direction inverted
|
||||
#[derive(Clone)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Rev<T> {
|
||||
iter: T
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
|
||||
type Item = <I as Iterator>::Item;
|
||||
|
||||
|
|
@ -1052,7 +1052,7 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
|
|||
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next() }
|
||||
|
|
@ -1071,12 +1071,12 @@ impl<I> RandomAccessIterator for Rev<I> where I: DoubleEndedIterator + RandomAcc
|
|||
|
||||
/// A mutable reference to an iterator
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct ByRef<'a, I:'a> {
|
||||
iter: &'a mut I,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, I> Iterator for ByRef<'a, I> where I: 'a + Iterator {
|
||||
type Item = <I as Iterator>::Item;
|
||||
|
||||
|
|
@ -1086,7 +1086,7 @@ impl<'a, I> Iterator for ByRef<'a, I> where I: 'a + Iterator {
|
|||
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, I> DoubleEndedIterator for ByRef<'a, I> where I: 'a + DoubleEndedIterator {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next_back() }
|
||||
|
|
@ -1232,7 +1232,7 @@ pub struct Cloned<I> {
|
|||
it: I,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, D, I> Iterator for Cloned<I> where
|
||||
T: Clone,
|
||||
D: Deref<Target=T>,
|
||||
|
|
@ -1249,7 +1249,7 @@ impl<T, D, I> Iterator for Cloned<I> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, D, I> DoubleEndedIterator for Cloned<I> where
|
||||
T: Clone,
|
||||
D: Deref<Target=T>,
|
||||
|
|
@ -1260,7 +1260,7 @@ impl<T, D, I> DoubleEndedIterator for Cloned<I> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, D, I> ExactSizeIterator for Cloned<I> where
|
||||
T: Clone,
|
||||
D: Deref<Target=T>,
|
||||
|
|
@ -1270,13 +1270,13 @@ impl<T, D, I> ExactSizeIterator for Cloned<I> where
|
|||
/// An iterator that repeats endlessly
|
||||
#[derive(Clone, Copy)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Cycle<I> {
|
||||
orig: I,
|
||||
iter: I,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> Iterator for Cycle<I> where I: Clone + Iterator {
|
||||
type Item = <I as Iterator>::Item;
|
||||
|
||||
|
|
@ -1329,14 +1329,14 @@ impl<I> RandomAccessIterator for Cycle<I> where
|
|||
/// An iterator that strings two iterators together
|
||||
#[derive(Clone)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Chain<A, B> {
|
||||
a: A,
|
||||
b: B,
|
||||
flag: bool,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, A, B> Iterator for Chain<A, B> where A: Iterator<Item=T>, B: Iterator<Item=T> {
|
||||
type Item = T;
|
||||
|
||||
|
|
@ -1370,7 +1370,7 @@ impl<T, A, B> Iterator for Chain<A, B> where A: Iterator<Item=T>, B: Iterator<It
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, A, B> DoubleEndedIterator for Chain<A, B> where
|
||||
A: DoubleEndedIterator<Item=T>,
|
||||
B: DoubleEndedIterator<Item=T>,
|
||||
|
|
@ -1409,13 +1409,13 @@ impl<T, A, B> RandomAccessIterator for Chain<A, B> where
|
|||
/// An iterator that iterates two other iterators simultaneously
|
||||
#[derive(Clone)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Zip<A, B> {
|
||||
a: A,
|
||||
b: B
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, U, A, B> Iterator for Zip<A, B> where
|
||||
A: Iterator<Item = T>,
|
||||
B: Iterator<Item = U>,
|
||||
|
|
@ -1451,7 +1451,7 @@ impl<T, U, A, B> Iterator for Zip<A, B> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, U, A, B> DoubleEndedIterator for Zip<A, B> where
|
||||
A: DoubleEndedIterator + ExactSizeIterator<Item=T>,
|
||||
B: DoubleEndedIterator + ExactSizeIterator<Item=U>,
|
||||
|
|
@ -1500,14 +1500,14 @@ impl<T, U, A, B> RandomAccessIterator for Zip<A, B> where
|
|||
|
||||
/// An iterator that maps the values of `iter` with `f`
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Map<A, B, I: Iterator<Item=A>, F: FnMut(A) -> B> {
|
||||
iter: I,
|
||||
f: F,
|
||||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, F> Clone for Map<A, B, I, F> where
|
||||
I: Clone + Iterator<Item=A>,
|
||||
F: Clone + FnMut(A) -> B,
|
||||
|
|
@ -1530,7 +1530,7 @@ impl<A, B, I, F> Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> B {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, F> Iterator for Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> B {
|
||||
type Item = B;
|
||||
|
||||
|
|
@ -1546,7 +1546,7 @@ impl<A, B, I, F> Iterator for Map<A, B, I, F> where I: Iterator<Item=A>, F: FnMu
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, F> DoubleEndedIterator for Map<A, B, I, F> where
|
||||
I: DoubleEndedIterator<Item=A>,
|
||||
F: FnMut(A) -> B,
|
||||
|
|
@ -1577,14 +1577,14 @@ impl<A, B, I, F> RandomAccessIterator for Map<A, B, I, F> where
|
|||
|
||||
/// An iterator that filters the elements of `iter` with `predicate`
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
|
||||
iter: I,
|
||||
predicate: P,
|
||||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, P> Clone for Filter<A, I, P> where
|
||||
I: Clone + Iterator<Item=A>,
|
||||
P: Clone + FnMut(&A) -> bool,
|
||||
|
|
@ -1597,7 +1597,7 @@ impl<A, I, P> Clone for Filter<A, I, P> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, P> Iterator for Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
|
||||
type Item = A;
|
||||
|
||||
|
|
@ -1620,7 +1620,7 @@ impl<A, I, P> Iterator for Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, P> DoubleEndedIterator for Filter<A, I, P> where
|
||||
I: DoubleEndedIterator<Item=A>,
|
||||
P: FnMut(&A) -> bool,
|
||||
|
|
@ -1638,14 +1638,14 @@ impl<A, I, P> DoubleEndedIterator for Filter<A, I, P> where
|
|||
|
||||
/// An iterator that uses `f` to both filter and map elements from `iter`
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct FilterMap<A, B, I, F> where I: Iterator<Item=A>, F: FnMut(A) -> Option<B> {
|
||||
iter: I,
|
||||
f: F,
|
||||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, F> Clone for FilterMap<A, B, I, F> where
|
||||
I: Clone + Iterator<Item=A>,
|
||||
F: Clone + FnMut(A) -> Option<B>,
|
||||
|
|
@ -1658,7 +1658,7 @@ impl<A, B, I, F> Clone for FilterMap<A, B, I, F> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where
|
||||
I: Iterator<Item=A>,
|
||||
F: FnMut(A) -> Option<B>,
|
||||
|
|
@ -1683,7 +1683,7 @@ impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, F> DoubleEndedIterator for FilterMap<A, B, I, F> where
|
||||
I: DoubleEndedIterator<Item=A>,
|
||||
F: FnMut(A) -> Option<B>,
|
||||
|
|
@ -1703,13 +1703,13 @@ impl<A, B, I, F> DoubleEndedIterator for FilterMap<A, B, I, F> where
|
|||
/// An iterator that yields the current count and the element during iteration
|
||||
#[derive(Clone)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Enumerate<I> {
|
||||
iter: I,
|
||||
count: uint
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> Iterator for Enumerate<I> where I: Iterator {
|
||||
type Item = (uint, <I as Iterator>::Item);
|
||||
|
||||
|
|
@ -1731,7 +1731,7 @@ impl<I> Iterator for Enumerate<I> where I: Iterator {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> DoubleEndedIterator for Enumerate<I> where
|
||||
I: ExactSizeIterator + DoubleEndedIterator
|
||||
{
|
||||
|
|
@ -1765,14 +1765,14 @@ impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator {
|
|||
|
||||
/// An iterator with a `peek()` that returns an optional reference to the next element.
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Copy)]
|
||||
pub struct Peekable<T, I> where I: Iterator<Item=T> {
|
||||
iter: I,
|
||||
peeked: Option<T>,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, I> Iterator for Peekable<T, I> where I: Iterator<Item=T> {
|
||||
type Item = T;
|
||||
|
||||
|
|
@ -1798,7 +1798,7 @@ impl<T, I> Iterator for Peekable<T, I> where I: Iterator<Item=T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, I> Peekable<T, I> where I: Iterator<Item=T> {
|
||||
/// Return a reference to the next element of the iterator with out advancing it,
|
||||
/// or None if the iterator is exhausted.
|
||||
|
|
@ -1822,7 +1822,7 @@ impl<T, I> Peekable<T, I> where I: Iterator<Item=T> {
|
|||
|
||||
/// An iterator that rejects elements while `predicate` is true
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
|
||||
iter: I,
|
||||
flag: bool,
|
||||
|
|
@ -1830,7 +1830,7 @@ pub struct SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
|
|||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, P> Clone for SkipWhile<A, I, P> where
|
||||
I: Clone + Iterator<Item=A>,
|
||||
P: Clone + FnMut(&A) -> bool,
|
||||
|
|
@ -1844,7 +1844,7 @@ impl<A, I, P> Clone for SkipWhile<A, I, P> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, P> Iterator for SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
|
||||
type Item = A;
|
||||
|
||||
|
|
@ -1868,7 +1868,7 @@ impl<A, I, P> Iterator for SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMu
|
|||
|
||||
/// An iterator that only accepts elements while `predicate` is true
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
|
||||
iter: I,
|
||||
flag: bool,
|
||||
|
|
@ -1876,7 +1876,7 @@ pub struct TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
|
|||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, P> Clone for TakeWhile<A, I, P> where
|
||||
I: Clone + Iterator<Item=A>,
|
||||
P: Clone + FnMut(&A) -> bool,
|
||||
|
|
@ -1890,7 +1890,7 @@ impl<A, I, P> Clone for TakeWhile<A, I, P> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, P> Iterator for TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMut(&A) -> bool {
|
||||
type Item = A;
|
||||
|
||||
|
|
@ -1923,13 +1923,13 @@ impl<A, I, P> Iterator for TakeWhile<A, I, P> where I: Iterator<Item=A>, P: FnMu
|
|||
/// An iterator that skips over `n` elements of `iter`.
|
||||
#[derive(Clone)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Skip<I> {
|
||||
iter: I,
|
||||
n: uint
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> Iterator for Skip<I> where I: Iterator {
|
||||
type Item = <I as Iterator>::Item;
|
||||
|
||||
|
|
@ -1993,13 +1993,13 @@ impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{
|
|||
/// An iterator that only iterates over the first `n` iterations of `iter`.
|
||||
#[derive(Clone)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Take<I> {
|
||||
iter: I,
|
||||
n: uint
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> Iterator for Take<I> where I: Iterator{
|
||||
type Item = <I as Iterator>::Item;
|
||||
|
||||
|
|
@ -2048,7 +2048,7 @@ impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{
|
|||
|
||||
/// An iterator to maintain state while iterating another iterator
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Scan<A, B, I, St, F> where I: Iterator, F: FnMut(&mut St, A) -> Option<B> {
|
||||
iter: I,
|
||||
f: F,
|
||||
|
|
@ -2058,7 +2058,7 @@ pub struct Scan<A, B, I, St, F> where I: Iterator, F: FnMut(&mut St, A) -> Optio
|
|||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, St, F> Clone for Scan<A, B, I, St, F> where
|
||||
I: Clone + Iterator<Item=A>,
|
||||
St: Clone,
|
||||
|
|
@ -2073,7 +2073,7 @@ impl<A, B, I, St, F> Clone for Scan<A, B, I, St, F> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, St, F> Iterator for Scan<A, B, I, St, F> where
|
||||
I: Iterator<Item=A>,
|
||||
F: FnMut(&mut St, A) -> Option<B>,
|
||||
|
|
@ -2096,7 +2096,7 @@ impl<A, B, I, St, F> Iterator for Scan<A, B, I, St, F> where
|
|||
/// and yields the elements of the produced iterators
|
||||
///
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct FlatMap<A, B, I, U, F> where
|
||||
I: Iterator<Item=A>,
|
||||
U: Iterator<Item=B>,
|
||||
|
|
@ -2109,7 +2109,7 @@ pub struct FlatMap<A, B, I, U, F> where
|
|||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, U, F> Clone for FlatMap<A, B, I, U, F> where
|
||||
I: Clone + Iterator<Item=A>,
|
||||
U: Clone + Iterator<Item=B>,
|
||||
|
|
@ -2125,7 +2125,7 @@ impl<A, B, I, U, F> Clone for FlatMap<A, B, I, U, F> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where
|
||||
I: Iterator<Item=A>,
|
||||
U: Iterator<Item=B>,
|
||||
|
|
@ -2160,7 +2160,7 @@ impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where
|
||||
I: DoubleEndedIterator<Item=A>,
|
||||
U: DoubleEndedIterator<Item=B>,
|
||||
|
|
@ -2187,13 +2187,13 @@ impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where
|
|||
/// yields `None` once.
|
||||
#[derive(Clone)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Fuse<I> {
|
||||
iter: I,
|
||||
done: bool
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> Iterator for Fuse<I> where I: Iterator {
|
||||
type Item = <I as Iterator>::Item;
|
||||
|
||||
|
|
@ -2222,7 +2222,7 @@ impl<I> Iterator for Fuse<I> where I: Iterator {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<<I as Iterator>::Item> {
|
||||
|
|
@ -2267,14 +2267,14 @@ impl<I> Fuse<I> {
|
|||
/// An iterator that calls a function with a reference to each
|
||||
/// element before yielding it.
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) {
|
||||
iter: I,
|
||||
f: F,
|
||||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, F> Clone for Inspect<A, I, F> where
|
||||
I: Clone + Iterator<Item=A>,
|
||||
F: Clone + FnMut(&A),
|
||||
|
|
@ -2299,7 +2299,7 @@ impl<A, I, F> Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, F> Iterator for Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(&A) {
|
||||
type Item = A;
|
||||
|
||||
|
|
@ -2315,7 +2315,7 @@ impl<A, I, F> Iterator for Inspect<A, I, F> where I: Iterator<Item=A>, F: FnMut(
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, I, F> DoubleEndedIterator for Inspect<A, I, F> where
|
||||
I: DoubleEndedIterator<Item=A>,
|
||||
F: FnMut(&A),
|
||||
|
|
@ -2384,7 +2384,7 @@ pub struct Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> {
|
|||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, St, F> Clone for Unfold<A, St, F> where
|
||||
F: Clone + FnMut(&mut St) -> Option<A>,
|
||||
St: Clone,
|
||||
|
|
@ -2410,7 +2410,7 @@ impl<A, St, F> Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, St, F> Iterator for Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> {
|
||||
type Item = A;
|
||||
|
||||
|
|
@ -2446,7 +2446,7 @@ pub fn count<A>(start: A, step: A) -> Counter<A> {
|
|||
Counter{state: start, step: step}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A: Add<Output=A> + Clone> Iterator for Counter<A> {
|
||||
type Item = A;
|
||||
|
||||
|
|
@ -2786,12 +2786,12 @@ step_impl_no_between!(u64 i64);
|
|||
|
||||
/// An iterator that repeats an element endlessly
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Repeat<A> {
|
||||
element: A
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A: Clone> Iterator for Repeat<A> {
|
||||
type Item = A;
|
||||
|
||||
|
|
@ -2801,7 +2801,7 @@ impl<A: Clone> Iterator for Repeat<A> {
|
|||
fn size_hint(&self) -> (uint, Option<uint>) { (uint::MAX, None) }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A: Clone> DoubleEndedIterator for Repeat<A> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<A> { self.idx(0) }
|
||||
|
|
@ -2855,7 +2855,7 @@ pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
|
|||
|
||||
/// Create a new iterator that endlessly repeats the element `elt`.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
|
||||
Repeat{element: elt}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ macro_rules! panic {
|
|||
/// assert!(a + b == 30, "a = {}, b = {}", a, b);
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
macro_rules! assert {
|
||||
($cond:expr) => (
|
||||
if !$cond {
|
||||
|
|
@ -79,7 +79,7 @@ macro_rules! assert {
|
|||
/// assert_eq!(a, b);
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
macro_rules! assert_eq {
|
||||
($left:expr , $right:expr) => ({
|
||||
match (&($left), &($right)) {
|
||||
|
|
@ -123,7 +123,7 @@ macro_rules! assert_eq {
|
|||
/// debug_assert!(a + b == 30, "a = {}, b = {}", a, b);
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
macro_rules! debug_assert {
|
||||
($($arg:tt)*) => (if cfg!(not(ndebug)) { assert!($($arg)*); })
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ macro_rules! write {
|
|||
/// Equivalent to the `write!` macro, except that a newline is appended after
|
||||
/// the message is written.
|
||||
#[macro_export]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
macro_rules! writeln {
|
||||
($dst:expr, $fmt:expr) => (
|
||||
write!($dst, concat!($fmt, "\n"))
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//! implemented using unsafe code. In that case, you may want to embed
|
||||
//! some of the marker types below into your type.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use clone::Clone;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ pub unsafe trait Send: 'static {
|
|||
}
|
||||
|
||||
/// Types with a constant size known at compile-time.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[lang="sized"]
|
||||
pub trait Sized {
|
||||
// Empty.
|
||||
|
|
@ -141,7 +141,7 @@ pub trait Sized {
|
|||
/// to consider though: if you think your type may _not_ be able to implement `Copy` in the future,
|
||||
/// then it might be prudent to not implement `Copy`. This is because removing `Copy` is a breaking
|
||||
/// change: that second example would fail to compile if we made `Foo` non-`Copy`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[lang="copy"]
|
||||
pub trait Copy {
|
||||
// Empty.
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@
|
|||
//! This module contains functions for querying the size and alignment of
|
||||
//! types, initializing and manipulating memory.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use marker::Sized;
|
||||
use intrinsics;
|
||||
use ptr;
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use intrinsics::transmute;
|
||||
|
||||
/// Moves a thing into the void.
|
||||
|
|
@ -29,7 +29,7 @@ pub use intrinsics::transmute;
|
|||
///
|
||||
/// This function is the unsafe version of the `drop` function because it does
|
||||
/// not run any destructors.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use intrinsics::forget;
|
||||
|
||||
/// Returns the size of a type in bytes.
|
||||
|
|
@ -42,7 +42,7 @@ pub use intrinsics::forget;
|
|||
/// assert_eq!(4, mem::size_of::<i32>());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn size_of<T>() -> uint {
|
||||
unsafe { intrinsics::size_of::<T>() }
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ pub fn size_of<T>() -> uint {
|
|||
/// assert_eq!(4, mem::size_of_val(&5i32));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn size_of_val<T>(_val: &T) -> uint {
|
||||
size_of::<T>()
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ pub fn size_of_val<T>(_val: &T) -> uint {
|
|||
/// assert_eq!(4, mem::min_align_of::<i32>());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn min_align_of<T>() -> uint {
|
||||
unsafe { intrinsics::min_align_of::<T>() }
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ pub fn min_align_of<T>() -> uint {
|
|||
/// assert_eq!(4, mem::min_align_of_val(&5i32));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn min_align_of_val<T>(_val: &T) -> uint {
|
||||
min_align_of::<T>()
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ pub fn min_align_of_val<T>(_val: &T) -> uint {
|
|||
/// assert_eq!(4, mem::align_of::<i32>());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn align_of<T>() -> uint {
|
||||
// We use the preferred alignment as the default alignment for a type. This
|
||||
// appears to be what clang migrated towards as well:
|
||||
|
|
@ -129,7 +129,7 @@ pub fn align_of<T>() -> uint {
|
|||
/// assert_eq!(4, mem::align_of_val(&5i32));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn align_of_val<T>(_val: &T) -> uint {
|
||||
align_of::<T>()
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ pub fn align_of_val<T>(_val: &T) -> uint {
|
|||
/// let x: int = unsafe { mem::zeroed() };
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn zeroed<T>() -> T {
|
||||
intrinsics::init()
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ pub unsafe fn zeroed<T>() -> T {
|
|||
/// let x: int = unsafe { mem::uninitialized() };
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn uninitialized<T>() -> T {
|
||||
intrinsics::uninit()
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ pub unsafe fn uninitialized<T>() -> T {
|
|||
/// assert_eq!(5i, *y);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn swap<T>(x: &mut T, y: &mut T) {
|
||||
unsafe {
|
||||
// Give ourselves some scratch space to work with
|
||||
|
|
@ -261,7 +261,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
|
|||
/// }
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn replace<T>(dest: &mut T, mut src: T) -> T {
|
||||
swap(dest, &mut src);
|
||||
src
|
||||
|
|
@ -288,7 +288,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
|
|||
/// println!("{}", *borrow);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn drop<T>(_x: T) { }
|
||||
|
||||
/// Interprets `src` as `&U`, and then reads `src` without moving the contained value.
|
||||
|
|
@ -311,7 +311,7 @@ pub fn drop<T>(_x: T) { }
|
|||
/// assert_eq!(1u, one);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
|
||||
ptr::read(src as *const T as *const U)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
|
||||
#![allow(overflowing_literals)]
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use intrinsics;
|
||||
use mem;
|
||||
|
|
@ -30,17 +30,17 @@ pub const MANTISSA_DIGITS: uint = 24u;
|
|||
#[unstable(feature = "core", reason = "pending integer conventions")]
|
||||
pub const DIGITS: uint = 6u;
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const EPSILON: f32 = 1.19209290e-07_f32;
|
||||
|
||||
/// Smallest finite f32 value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN_VALUE: f32 = -3.40282347e+38_f32;
|
||||
/// Smallest positive, normalized f32 value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
|
||||
/// Largest finite f32 value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MAX_VALUE: f32 = 3.40282347e+38_f32;
|
||||
|
||||
#[unstable(feature = "core", reason = "pending integer conventions")]
|
||||
|
|
@ -53,11 +53,11 @@ pub const MIN_10_EXP: int = -37;
|
|||
#[unstable(feature = "core", reason = "pending integer conventions")]
|
||||
pub const MAX_10_EXP: int = 38;
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const NAN: f32 = 0.0_f32/0.0_f32;
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const INFINITY: f32 = 1.0_f32/0.0_f32;
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
|
||||
|
||||
/// Various useful constants.
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
|
||||
#![allow(overflowing_literals)]
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use intrinsics;
|
||||
use mem;
|
||||
|
|
@ -33,17 +33,17 @@ pub const MANTISSA_DIGITS: uint = 53u;
|
|||
#[unstable(feature = "core", reason = "pending integer conventions")]
|
||||
pub const DIGITS: uint = 15u;
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
|
||||
|
||||
/// Smallest finite f64 value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
|
||||
/// Smallest positive, normalized f64 value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
|
||||
/// Largest finite f64 value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
|
||||
|
||||
#[unstable(feature = "core", reason = "pending integer conventions")]
|
||||
|
|
@ -56,11 +56,11 @@ pub const MIN_10_EXP: int = -307;
|
|||
#[unstable(feature = "core", reason = "pending integer conventions")]
|
||||
pub const MAX_10_EXP: int = 308;
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const NAN: f64 = 0.0_f64/0.0_f64;
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const INFINITY: f64 = 1.0_f64/0.0_f64;
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
|
||||
|
||||
/// Various useful constants.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Operations and constants for signed 16-bits integers (`i16` type)
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "i16")]
|
||||
|
||||
int_module! { i16, 16 }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Operations and constants for signed 32-bits integers (`i32` type)
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "i32")]
|
||||
|
||||
int_module! { i32, 32 }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Operations and constants for signed 64-bits integers (`i64` type)
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "i64")]
|
||||
|
||||
int_module! { i64, 64 }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Operations and constants for signed 8-bits integers (`i8` type)
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "i8")]
|
||||
|
||||
int_module! { i8, 8 }
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ pub const BYTES : uint = ($bits / 8);
|
|||
|
||||
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
|
||||
// calling the `Bounded::min_value` function.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN: $T = (-1 as $T) << (BITS - 1);
|
||||
// FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0.
|
||||
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
|
||||
// calling the `Bounded::max_value` function.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MAX: $T = !MIN;
|
||||
|
||||
) }
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//! new type will gradually take place over the alpha cycle along with
|
||||
//! the development of clearer conventions around integer types.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "isize")]
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
//! Numeric traits and functions for the built-in numeric types.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use char::CharExt;
|
||||
|
|
@ -30,7 +30,7 @@ use option::Option::{Some, None};
|
|||
use str::{FromStr, StrExt};
|
||||
|
||||
/// A built-in signed or unsigned integer.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Int
|
||||
: Copy + Clone
|
||||
+ NumCast
|
||||
|
|
@ -183,7 +183,7 @@ pub trait Int
|
|||
///
|
||||
/// assert_eq!(n.swap_bytes(), m);
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn swap_bytes(self) -> Self;
|
||||
|
||||
/// Convert an integer from big endian to the target's endianness.
|
||||
|
|
@ -203,7 +203,7 @@ pub trait Int
|
|||
/// assert_eq!(Int::from_be(n), n.swap_bytes())
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn from_be(x: Self) -> Self {
|
||||
if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
|
||||
|
|
@ -226,7 +226,7 @@ pub trait Int
|
|||
/// assert_eq!(Int::from_le(n), n.swap_bytes())
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn from_le(x: Self) -> Self {
|
||||
if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
|
||||
|
|
@ -249,7 +249,7 @@ pub trait Int
|
|||
/// assert_eq!(n.to_be(), n.swap_bytes())
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn to_be(self) -> Self { // or not to be?
|
||||
if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
|
||||
|
|
@ -272,7 +272,7 @@ pub trait Int
|
|||
/// assert_eq!(n.to_le(), n.swap_bytes())
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn to_le(self) -> Self {
|
||||
if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
|
||||
|
|
@ -289,7 +289,7 @@ pub trait Int
|
|||
/// assert_eq!(5u16.checked_add(65530), Some(65535));
|
||||
/// assert_eq!(6u16.checked_add(65530), None);
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn checked_add(self, other: Self) -> Option<Self>;
|
||||
|
||||
/// Checked integer subtraction. Computes `self - other`, returning `None`
|
||||
|
|
@ -303,7 +303,7 @@ pub trait Int
|
|||
/// assert_eq!((-127i8).checked_sub(1), Some(-128));
|
||||
/// assert_eq!((-128i8).checked_sub(1), None);
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn checked_sub(self, other: Self) -> Option<Self>;
|
||||
|
||||
/// Checked integer multiplication. Computes `self * other`, returning
|
||||
|
|
@ -317,7 +317,7 @@ pub trait Int
|
|||
/// assert_eq!(5u8.checked_mul(51), Some(255));
|
||||
/// assert_eq!(5u8.checked_mul(52), None);
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn checked_mul(self, other: Self) -> Option<Self>;
|
||||
|
||||
/// Checked integer division. Computes `self / other`, returning `None` if
|
||||
|
|
@ -332,12 +332,12 @@ pub trait Int
|
|||
/// assert_eq!((-128i8).checked_div(-1), None);
|
||||
/// assert_eq!((1i8).checked_div(0), None);
|
||||
/// ```
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn checked_div(self, other: Self) -> Option<Self>;
|
||||
|
||||
/// Saturating integer addition. Computes `self + other`, saturating at
|
||||
/// the numeric bounds instead of overflowing.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn saturating_add(self, other: Self) -> Self {
|
||||
match self.checked_add(other) {
|
||||
|
|
@ -349,7 +349,7 @@ pub trait Int
|
|||
|
||||
/// Saturating integer subtraction. Computes `self - other`, saturating at
|
||||
/// the numeric bounds instead of overflowing.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn saturating_sub(self, other: Self) -> Self {
|
||||
match self.checked_sub(other) {
|
||||
|
|
@ -401,7 +401,7 @@ macro_rules! uint_impl {
|
|||
$add_with_overflow:path,
|
||||
$sub_with_overflow:path,
|
||||
$mul_with_overflow:path) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Int for $T {
|
||||
#[inline]
|
||||
fn zero() -> $T { 0 }
|
||||
|
|
@ -532,7 +532,7 @@ macro_rules! int_impl {
|
|||
$add_with_overflow:path,
|
||||
$sub_with_overflow:path,
|
||||
$mul_with_overflow:path) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Int for $T {
|
||||
#[inline]
|
||||
fn zero() -> $T { 0 }
|
||||
|
|
@ -625,7 +625,7 @@ int_impl! { int = i64, u64, 64,
|
|||
intrinsics::i64_mul_with_overflow }
|
||||
|
||||
/// A built-in two's complement integer.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait SignedInt
|
||||
: Int
|
||||
+ Neg<Output=Self>
|
||||
|
|
@ -640,23 +640,23 @@ pub trait SignedInt
|
|||
/// - `0` if the number is zero
|
||||
/// - `1` if the number is positive
|
||||
/// - `-1` if the number is negative
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn signum(self) -> Self;
|
||||
|
||||
/// Returns `true` if `self` is positive and `false` if the number
|
||||
/// is zero or negative.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn is_positive(self) -> bool;
|
||||
|
||||
/// Returns `true` if `self` is negative and `false` if the number
|
||||
/// is zero or positive.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn is_negative(self) -> bool;
|
||||
}
|
||||
|
||||
macro_rules! signed_int_impl {
|
||||
($T:ty) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl SignedInt for $T {
|
||||
#[inline]
|
||||
fn abs(self) -> $T {
|
||||
|
|
@ -688,10 +688,10 @@ signed_int_impl! { i64 }
|
|||
signed_int_impl! { int }
|
||||
|
||||
/// A built-in unsigned integer.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait UnsignedInt: Int {
|
||||
/// Returns `true` iff `self == 2^k` for some `k`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn is_power_of_two(self) -> bool {
|
||||
(self - Int::one()) & self == Int::zero() && !(self == Int::zero())
|
||||
|
|
@ -699,7 +699,7 @@ pub trait UnsignedInt: Int {
|
|||
|
||||
/// Returns the smallest power of two greater than or equal to `self`.
|
||||
/// Unspecified behavior on overflow.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn next_power_of_two(self) -> Self {
|
||||
let bits = size_of::<Self>() * 8;
|
||||
|
|
@ -710,7 +710,7 @@ pub trait UnsignedInt: Int {
|
|||
/// Returns the smallest power of two greater than or equal to `n`. If the
|
||||
/// next power of two is greater than the type's maximum value, `None` is
|
||||
/// returned, otherwise the power of two is wrapped in `Some`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn checked_next_power_of_two(self) -> Option<Self> {
|
||||
let npot = self.next_power_of_two();
|
||||
if npot >= self {
|
||||
|
|
@ -721,19 +721,19 @@ pub trait UnsignedInt: Int {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl UnsignedInt for uint {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl UnsignedInt for u8 {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl UnsignedInt for u16 {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl UnsignedInt for u32 {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl UnsignedInt for u64 {}
|
||||
|
||||
/// A generic trait for converting a value to a number.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Operations and constants for unsigned 16-bits integers (`u16` type)
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "u16")]
|
||||
|
||||
uint_module! { u16, i16, 16 }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Operations and constants for unsigned 32-bits integers (`u32` type)
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "u32")]
|
||||
|
||||
uint_module! { u32, i32, 32 }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Operations and constants for unsigned 64-bits integer (`u64` type)
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "u64")]
|
||||
|
||||
uint_module! { u64, i64, 64 }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Operations and constants for unsigned 8-bits integers (`u8` type)
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "u8")]
|
||||
|
||||
uint_module! { u8, i8, 8 }
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ pub const BITS : uint = $bits;
|
|||
#[unstable(feature = "core")]
|
||||
pub const BYTES : uint = ($bits / 8);
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MIN: $T = 0 as $T;
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MAX: $T = 0 as $T - 1 as $T;
|
||||
|
||||
) }
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//! new type will gradually take place over the alpha cycle along with
|
||||
//! the development of clearer conventions around integer types.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "usize")]
|
||||
|
||||
uint_module! { usize, isize, ::isize::BITS }
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
//! See the documentation for each trait for a minimum implementation that prints
|
||||
//! something to the screen.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use clone::Clone;
|
||||
use iter::{Step, Iterator,DoubleEndedIterator,ExactSizeIterator};
|
||||
|
|
@ -97,10 +97,10 @@ use fmt;
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="drop"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Drop {
|
||||
/// The `drop` method, called when the value goes out of scope.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn drop(&mut self);
|
||||
}
|
||||
|
||||
|
|
@ -189,19 +189,19 @@ macro_rules! forward_ref_binop {
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="add"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Add<RHS=Self> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `+` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn add(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! add_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Add for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -244,19 +244,19 @@ add_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="sub"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Sub<RHS=Self> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `-` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn sub(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! sub_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Sub for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -299,19 +299,19 @@ sub_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="mul"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Mul<RHS=Self> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `*` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn mul(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! mul_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Mul for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -354,19 +354,19 @@ mul_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="div"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Div<RHS=Self> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `/` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn div(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! div_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Div for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -409,19 +409,19 @@ div_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="rem"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Rem<RHS=Self> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output = Self;
|
||||
|
||||
/// The method for the `%` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn rem(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! rem_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Rem for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -435,7 +435,7 @@ macro_rules! rem_impl {
|
|||
|
||||
macro_rules! rem_float_impl {
|
||||
($t:ty, $fmod:ident) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Rem for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -484,25 +484,25 @@ rem_float_impl! { f64, fmod }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="neg"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Neg {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the unary `-` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn neg(self) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! neg_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Neg for $t {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output = $t;
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn neg(self) -> $t { -self }
|
||||
}
|
||||
|
||||
|
|
@ -512,7 +512,7 @@ macro_rules! neg_impl {
|
|||
|
||||
macro_rules! neg_uint_impl {
|
||||
($t:ty, $t_signed:ty) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Neg for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -563,19 +563,19 @@ neg_uint_impl! { u64, i64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="not"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Not {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the unary `!` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn not(self) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! not_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Not for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -618,19 +618,19 @@ not_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="bitand"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait BitAnd<RHS=Self> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `&` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn bitand(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! bitand_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl BitAnd for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -673,19 +673,19 @@ bitand_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="bitor"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait BitOr<RHS=Self> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `|` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn bitor(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! bitor_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl BitOr for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -728,19 +728,19 @@ bitor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="bitxor"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait BitXor<RHS=Self> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `^` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn bitxor(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! bitxor_impl {
|
||||
($($t:ty)*) => ($(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl BitXor for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -783,19 +783,19 @@ bitxor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="shl"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Shl<RHS> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `<<` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn shl(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! shl_impl {
|
||||
($t:ty, $f:ty) => (
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Shl<$f> for $t {
|
||||
type Output = $t;
|
||||
|
||||
|
|
@ -856,13 +856,13 @@ shl_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="shr"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Shr<RHS> {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Output;
|
||||
|
||||
/// The method for the `>>` operator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn shr(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
|
|
@ -1120,24 +1120,24 @@ impl<Idx: fmt::Show> fmt::Show for RangeTo<Idx> {
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="deref"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Deref {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
type Target: ?Sized;
|
||||
|
||||
/// The method called to dereference a value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn deref<'a>(&'a self) -> &'a Self::Target;
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T: ?Sized> Deref for &'a T {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &T { *self }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T: ?Sized> Deref for &'a mut T {
|
||||
type Target = T;
|
||||
|
||||
|
|
@ -1182,14 +1182,14 @@ impl<'a, T: ?Sized> Deref for &'a mut T {
|
|||
/// }
|
||||
/// ```
|
||||
#[lang="deref_mut"]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait DerefMut: Deref {
|
||||
/// The method called to mutably dereference a value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn deref_mut<'a>(&'a mut self) -> &'a mut Self::Target;
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T: ?Sized> DerefMut for &'a mut T {
|
||||
fn deref_mut(&mut self) -> &mut T { *self }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@
|
|||
//! }
|
||||
//! ```
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use self::Option::*;
|
||||
|
||||
|
|
@ -164,13 +164,13 @@ use slice;
|
|||
|
||||
/// The `Option` type.
|
||||
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub enum Option<T> {
|
||||
/// No value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
None,
|
||||
/// Some value `T`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Some(T)
|
||||
}
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x.is_some(), false);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_some(&self) -> bool {
|
||||
match *self {
|
||||
Some(_) => true,
|
||||
|
|
@ -215,7 +215,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x.is_none(), true);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_none(&self) -> bool {
|
||||
!self.is_some()
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ impl<T> Option<T> {
|
|||
/// println!("still can print num_as_str: {:?}", num_as_str);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn as_ref<'r>(&'r self) -> Option<&'r T> {
|
||||
match *self {
|
||||
Some(ref x) => Some(x),
|
||||
|
|
@ -262,7 +262,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x, Some(42u));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> {
|
||||
match *self {
|
||||
Some(ref mut x) => Some(x),
|
||||
|
|
@ -323,7 +323,7 @@ impl<T> Option<T> {
|
|||
/// x.expect("the world is ending"); // panics with `world is ending`
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn expect(self, msg: &str) -> T {
|
||||
match self {
|
||||
Some(val) => val,
|
||||
|
|
@ -355,7 +355,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x.unwrap(), "air"); // fails
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap(self) -> T {
|
||||
match self {
|
||||
Some(val) => val,
|
||||
|
|
@ -372,7 +372,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(None.unwrap_or("bike"), "bike");
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap_or(self, def: T) -> T {
|
||||
match self {
|
||||
Some(x) => x,
|
||||
|
|
@ -390,7 +390,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(None.unwrap_or_else(|| 2 * k), 20u);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
|
||||
match self {
|
||||
Some(x) => x,
|
||||
|
|
@ -414,7 +414,7 @@ impl<T> Option<T> {
|
|||
/// let num_as_int: Option<uint> = num_as_str.map(|n| n.len());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
|
||||
match self {
|
||||
Some(x) => Some(f(x)),
|
||||
|
|
@ -434,7 +434,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x.map_or(42u, |v| v.len()), 42u);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn map_or<U, F: FnOnce(T) -> U>(self, def: U, f: F) -> U {
|
||||
match self {
|
||||
Some(t) => f(t),
|
||||
|
|
@ -456,7 +456,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42u);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn map_or_else<U, D: FnOnce() -> U, F: FnOnce(T) -> U>(self, def: D, f: F) -> U {
|
||||
match self {
|
||||
Some(t) => f(t),
|
||||
|
|
@ -522,7 +522,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x.iter().next(), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
Iter { inner: Item { opt: self.as_ref() } }
|
||||
}
|
||||
|
|
@ -563,7 +563,7 @@ impl<T> Option<T> {
|
|||
/// assert!(v.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn into_iter(self) -> IntoIter<T> {
|
||||
IntoIter { inner: Item { opt: self } }
|
||||
}
|
||||
|
|
@ -594,7 +594,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x.and(y), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn and<U>(self, optb: Option<U>) -> Option<U> {
|
||||
match self {
|
||||
Some(_) => optb,
|
||||
|
|
@ -617,7 +617,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(None.and_then(sq).and_then(sq), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn and_then<U, F: FnOnce(T) -> Option<U>>(self, f: F) -> Option<U> {
|
||||
match self {
|
||||
Some(x) => f(x),
|
||||
|
|
@ -647,7 +647,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x.or(y), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn or(self, optb: Option<T>) -> Option<T> {
|
||||
match self {
|
||||
Some(_) => self,
|
||||
|
|
@ -669,7 +669,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(None.or_else(nobody), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
|
||||
match self {
|
||||
Some(_) => self,
|
||||
|
|
@ -695,7 +695,7 @@ impl<T> Option<T> {
|
|||
/// assert_eq!(x, None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn take(&mut self) -> Option<T> {
|
||||
mem::replace(self, None)
|
||||
}
|
||||
|
|
@ -735,7 +735,7 @@ impl<T: Default> Option<T> {
|
|||
/// assert_eq!(0i, bad_year);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap_or_default(self) -> T {
|
||||
match self {
|
||||
Some(x) => x,
|
||||
|
|
@ -764,10 +764,10 @@ impl<T> AsSlice<T> for Option<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Default for Option<T> {
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn default() -> Option<T> { None }
|
||||
}
|
||||
|
||||
|
|
@ -807,10 +807,10 @@ impl<A> DoubleEndedIterator for Item<A> {
|
|||
impl<A> ExactSizeIterator for Item<A> {}
|
||||
|
||||
/// An iterator over a reference of the contained item in an Option.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, A: 'a> { inner: Item<&'a A> }
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A> Iterator for Iter<'a, A> {
|
||||
type Item = &'a A;
|
||||
|
||||
|
|
@ -820,16 +820,16 @@ impl<'a, A> Iterator for Iter<'a, A> {
|
|||
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A> DoubleEndedIterator for Iter<'a, A> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a A> { self.inner.next_back() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A> ExactSizeIterator for Iter<'a, A> {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A> Clone for Iter<'a, A> {
|
||||
fn clone(&self) -> Iter<'a, A> {
|
||||
Iter { inner: self.inner.clone() }
|
||||
|
|
@ -837,10 +837,10 @@ impl<'a, A> Clone for Iter<'a, A> {
|
|||
}
|
||||
|
||||
/// An iterator over a mutable reference of the contained item in an Option.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IterMut<'a, A: 'a> { inner: Item<&'a mut A> }
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A> Iterator for IterMut<'a, A> {
|
||||
type Item = &'a mut A;
|
||||
|
||||
|
|
@ -850,20 +850,20 @@ impl<'a, A> Iterator for IterMut<'a, A> {
|
|||
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A> DoubleEndedIterator for IterMut<'a, A> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a mut A> { self.inner.next_back() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A> ExactSizeIterator for IterMut<'a, A> {}
|
||||
|
||||
/// An iterator over the item contained inside an Option.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<A> { inner: Item<A> }
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A> Iterator for IntoIter<A> {
|
||||
type Item = A;
|
||||
|
||||
|
|
@ -873,20 +873,20 @@ impl<A> Iterator for IntoIter<A> {
|
|||
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A> DoubleEndedIterator for IntoIter<A> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<A> { self.inner.next_back() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A> ExactSizeIterator for IntoIter<A> {}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FromIterator
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
|
||||
/// Takes each element in the `Iterator`: if it is `None`, no further
|
||||
/// elements are taken, and the `None` is returned. Should no `None` occur, a
|
||||
|
|
@ -906,7 +906,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
|
|||
/// assert!(res == Some(vec!(2u, 3u)));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn from_iter<I: Iterator<Item=Option<A>>>(iter: I) -> Option<V> {
|
||||
// FIXME(#11084): This could be replaced with Iterator::scan when this
|
||||
// performance bug is closed.
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
//! but C APIs hand out a lot of pointers generally, so are a common source
|
||||
//! of unsafe pointers in Rust.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use mem;
|
||||
use clone::Clone;
|
||||
|
|
@ -121,7 +121,7 @@ pub use intrinsics::set_memory;
|
|||
/// assert!(p.is_null());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn null<T>() -> *const T { 0 as *const T }
|
||||
|
||||
/// Creates a null mutable raw pointer.
|
||||
|
|
@ -135,7 +135,7 @@ pub fn null<T>() -> *const T { 0 as *const T }
|
|||
/// assert!(p.is_null());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn null_mut<T>() -> *mut T { 0 as *mut T }
|
||||
|
||||
/// Zeroes out `count * size_of::<T>` bytes of memory at `dst`. `count` may be
|
||||
|
|
@ -160,7 +160,7 @@ pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) {
|
|||
///
|
||||
/// This is only unsafe because it accepts a raw pointer.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
|
||||
// Give ourselves some scratch space to work with
|
||||
let mut tmp: T = mem::uninitialized();
|
||||
|
|
@ -184,7 +184,7 @@ pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
|
|||
/// This is only unsafe because it accepts a raw pointer.
|
||||
/// Otherwise, this operation is identical to `mem::replace`.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
|
||||
mem::swap(mem::transmute(dest), &mut src); // cannot overlap
|
||||
src
|
||||
|
|
@ -202,7 +202,7 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
|
|||
/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
|
||||
/// because it will attempt to drop the value previously at `*src`.
|
||||
#[inline(always)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn read<T>(src: *const T) -> T {
|
||||
let mut tmp: T = mem::uninitialized();
|
||||
copy_nonoverlapping_memory(&mut tmp, src, 1);
|
||||
|
|
@ -239,18 +239,18 @@ pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
|
|||
/// This is appropriate for initializing uninitialized memory, or overwriting
|
||||
/// memory that has previously been `read` from.
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn write<T>(dst: *mut T, src: T) {
|
||||
intrinsics::move_val_init(&mut *dst, src)
|
||||
}
|
||||
|
||||
/// Methods on raw pointers
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait PtrExt: Sized {
|
||||
type Target;
|
||||
|
||||
/// Returns true if the pointer is null.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn is_null(self) -> bool;
|
||||
|
||||
/// Returns `None` if the pointer is null, or else returns a reference to
|
||||
|
|
@ -275,12 +275,12 @@ pub trait PtrExt: Sized {
|
|||
/// The offset must be in-bounds of the object, or one-byte-past-the-end.
|
||||
/// Otherwise `offset` invokes Undefined Behaviour, regardless of whether
|
||||
/// the pointer is used.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn offset(self, count: int) -> Self;
|
||||
}
|
||||
|
||||
/// Methods on mutable raw pointers
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait MutPtrExt {
|
||||
type Target;
|
||||
|
||||
|
|
@ -297,16 +297,16 @@ pub trait MutPtrExt {
|
|||
unsafe fn as_mut<'a>(&self) -> Option<&'a mut Self::Target>;
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> PtrExt for *const T {
|
||||
type Target = T;
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn is_null(self) -> bool { self as uint == 0 }
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn offset(self, count: int) -> *const T {
|
||||
intrinsics::offset(self, count)
|
||||
}
|
||||
|
|
@ -324,16 +324,16 @@ impl<T> PtrExt for *const T {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> PtrExt for *mut T {
|
||||
type Target = T;
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn is_null(self) -> bool { self as uint == 0 }
|
||||
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe fn offset(self, count: int) -> *mut T {
|
||||
intrinsics::offset(self, count) as *mut T
|
||||
}
|
||||
|
|
@ -351,7 +351,7 @@ impl<T> PtrExt for *mut T {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> MutPtrExt for *mut T {
|
||||
type Target = T;
|
||||
|
||||
|
|
@ -369,7 +369,7 @@ impl<T> MutPtrExt for *mut T {
|
|||
}
|
||||
|
||||
// Equality for pointers
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> PartialEq for *const T {
|
||||
#[inline]
|
||||
fn eq(&self, other: &*const T) -> bool {
|
||||
|
|
@ -379,10 +379,10 @@ impl<T> PartialEq for *const T {
|
|||
fn ne(&self, other: &*const T) -> bool { !self.eq(other) }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Eq for *const T {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> PartialEq for *mut T {
|
||||
#[inline]
|
||||
fn eq(&self, other: &*mut T) -> bool {
|
||||
|
|
@ -392,10 +392,10 @@ impl<T> PartialEq for *mut T {
|
|||
fn ne(&self, other: &*mut T) -> bool { !self.eq(other) }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Eq for *mut T {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Clone for *const T {
|
||||
#[inline]
|
||||
fn clone(&self) -> *const T {
|
||||
|
|
@ -403,7 +403,7 @@ impl<T> Clone for *const T {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Clone for *mut T {
|
||||
#[inline]
|
||||
fn clone(&self) -> *mut T {
|
||||
|
|
@ -416,7 +416,7 @@ mod externfnpointers {
|
|||
use mem;
|
||||
use cmp::PartialEq;
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<_R> PartialEq for extern "C" fn() -> _R {
|
||||
#[inline]
|
||||
fn eq(&self, other: &extern "C" fn() -> _R) -> bool {
|
||||
|
|
@ -427,7 +427,7 @@ mod externfnpointers {
|
|||
}
|
||||
macro_rules! fnptreq {
|
||||
($($p:ident),*) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<_R,$($p),*> PartialEq for extern "C" fn($($p),*) -> _R {
|
||||
#[inline]
|
||||
fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
|
||||
|
|
@ -447,7 +447,7 @@ mod externfnpointers {
|
|||
}
|
||||
|
||||
// Comparison for pointers
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Ord for *const T {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &*const T) -> Ordering {
|
||||
|
|
@ -461,7 +461,7 @@ impl<T> Ord for *const T {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> PartialOrd for *const T {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &*const T) -> Option<Ordering> {
|
||||
|
|
@ -481,7 +481,7 @@ impl<T> PartialOrd for *const T {
|
|||
fn ge(&self, other: &*const T) -> bool { *self >= *other }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Ord for *mut T {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &*mut T) -> Ordering {
|
||||
|
|
@ -495,7 +495,7 @@ impl<T> Ord for *mut T {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> PartialOrd for *mut T {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &*mut T) -> Option<Ordering> {
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@
|
|||
//!
|
||||
//! `try!` is imported by the prelude, and is available everywhere.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use self::Result::{Ok, Err};
|
||||
|
||||
|
|
@ -241,14 +241,14 @@ use slice;
|
|||
/// See the [`std::result`](index.html) module documentation for details.
|
||||
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
|
||||
#[must_use]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub enum Result<T, E> {
|
||||
/// Contains the success value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Ok(T),
|
||||
|
||||
/// Contains the error value
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Err(E)
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ pub enum Result<T, E> {
|
|||
// Type implementation
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, E> Result<T, E> {
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Querying the contained values
|
||||
|
|
@ -274,7 +274,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.is_ok(), false);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_ok(&self) -> bool {
|
||||
match *self {
|
||||
Ok(_) => true,
|
||||
|
|
@ -294,7 +294,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.is_err(), true);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_err(&self) -> bool {
|
||||
!self.is_ok()
|
||||
}
|
||||
|
|
@ -318,7 +318,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.ok(), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn ok(self) -> Option<T> {
|
||||
match self {
|
||||
Ok(x) => Some(x),
|
||||
|
|
@ -341,7 +341,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.err(), Some("Nothing here"));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn err(self) -> Option<E> {
|
||||
match self {
|
||||
Ok(_) => None,
|
||||
|
|
@ -366,7 +366,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.as_ref(), Err(&"Error"));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn as_ref(&self) -> Result<&T, &E> {
|
||||
match *self {
|
||||
Ok(ref x) => Ok(x),
|
||||
|
|
@ -393,7 +393,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.unwrap_err(), 0);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn as_mut(&mut self) -> Result<&mut T, &mut E> {
|
||||
match *self {
|
||||
Ok(ref mut x) => Ok(x),
|
||||
|
|
@ -464,7 +464,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert!(sum == 10);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> Result<U,E> {
|
||||
match self {
|
||||
Ok(t) => Ok(op(t)),
|
||||
|
|
@ -490,7 +490,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.map_err(stringify), Err("error code: 13".to_string()));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> Result<T,F> {
|
||||
match self {
|
||||
Ok(t) => Ok(t),
|
||||
|
|
@ -514,7 +514,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.iter().next(), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
Iter { inner: self.as_ref().ok() }
|
||||
}
|
||||
|
|
@ -535,7 +535,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.iter_mut().next(), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter_mut(&mut self) -> IterMut<T> {
|
||||
IterMut { inner: self.as_mut().ok() }
|
||||
}
|
||||
|
|
@ -554,7 +554,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(v, vec![]);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn into_iter(self) -> IntoIter<T> {
|
||||
IntoIter { inner: self.ok() }
|
||||
}
|
||||
|
|
@ -585,7 +585,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.and(y), Ok("different result type"));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn and<U>(self, res: Result<U, E>) -> Result<U, E> {
|
||||
match self {
|
||||
Ok(_) => res,
|
||||
|
|
@ -609,7 +609,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(Err(3).and_then(sq).and_then(sq), Err(3));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> {
|
||||
match self {
|
||||
Ok(t) => op(t),
|
||||
|
|
@ -639,7 +639,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.or(y), Ok(2));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn or(self, res: Result<T, E>) -> Result<T, E> {
|
||||
match self {
|
||||
Ok(_) => self,
|
||||
|
|
@ -663,7 +663,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(Err(3).or_else(err).or_else(err), Err(3));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn or_else<F, O: FnOnce(E) -> Result<T, F>>(self, op: O) -> Result<T, F> {
|
||||
match self {
|
||||
Ok(t) => Ok(t),
|
||||
|
|
@ -685,7 +685,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(x.unwrap_or(optb), optb);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap_or(self, optb: T) -> T {
|
||||
match self {
|
||||
Ok(t) => t,
|
||||
|
|
@ -705,7 +705,7 @@ impl<T, E> Result<T, E> {
|
|||
/// assert_eq!(Err("foo").unwrap_or_else(count), 3u);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T {
|
||||
match self {
|
||||
Ok(t) => t,
|
||||
|
|
@ -714,7 +714,7 @@ impl<T, E> Result<T, E> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, E: Show> Result<T, E> {
|
||||
/// Unwraps a result, yielding the content of an `Ok`.
|
||||
///
|
||||
|
|
@ -735,7 +735,7 @@ impl<T, E: Show> Result<T, E> {
|
|||
/// x.unwrap(); // panics with `emergency failure`
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap(self) -> T {
|
||||
match self {
|
||||
Ok(t) => t,
|
||||
|
|
@ -745,7 +745,7 @@ impl<T, E: Show> Result<T, E> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Show, E> Result<T, E> {
|
||||
/// Unwraps a result, yielding the content of an `Err`.
|
||||
///
|
||||
|
|
@ -766,7 +766,7 @@ impl<T: Show, E> Result<T, E> {
|
|||
/// assert_eq!(x.unwrap_err(), "emergency failure");
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap_err(self) -> E {
|
||||
match self {
|
||||
Ok(t) =>
|
||||
|
|
@ -783,7 +783,7 @@ impl<T: Show, E> Result<T, E> {
|
|||
impl<T, E> AsSlice<T> for Result<T, E> {
|
||||
/// Convert from `Result<T, E>` to `&[T]` (without copying)
|
||||
#[inline]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn as_slice<'a>(&'a self) -> &'a [T] {
|
||||
match *self {
|
||||
Ok(ref x) => slice::ref_slice(x),
|
||||
|
|
@ -801,10 +801,10 @@ impl<T, E> AsSlice<T> for Result<T, E> {
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// An iterator over a reference to the `Ok` variant of a `Result`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, T: 'a> { inner: Option<&'a T> }
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Iterator for Iter<'a, T> {
|
||||
type Item = &'a T;
|
||||
|
||||
|
|
@ -817,13 +817,13 @@ impl<'a, T> Iterator for Iter<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a T> { self.inner.take() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
|
||||
|
||||
impl<'a, T> Clone for Iter<'a, T> {
|
||||
|
|
@ -831,10 +831,10 @@ impl<'a, T> Clone for Iter<'a, T> {
|
|||
}
|
||||
|
||||
/// An iterator over a mutable reference to the `Ok` variant of a `Result`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IterMut<'a, T: 'a> { inner: Option<&'a mut T> }
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Iterator for IterMut<'a, T> {
|
||||
type Item = &'a mut T;
|
||||
|
||||
|
|
@ -847,20 +847,20 @@ impl<'a, T> Iterator for IterMut<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a mut T> { self.inner.take() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
|
||||
|
||||
/// An iterator over the value in a `Ok` variant of a `Result`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<T> { inner: Option<T> }
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Iterator for IntoIter<T> {
|
||||
type Item = T;
|
||||
|
||||
|
|
@ -873,20 +873,20 @@ impl<T> Iterator for IntoIter<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> DoubleEndedIterator for IntoIter<T> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<T> { self.inner.take() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> ExactSizeIterator for IntoIter<T> {}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FromIterator
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
|
||||
/// Takes each element in the `Iterator`: if it is an `Err`, no further
|
||||
/// elements are taken, and the `Err` is returned. Should no `Err` occur, a
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
//!
|
||||
//! For more details `std::slice`.
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "slice")]
|
||||
|
||||
// How this module is organized.
|
||||
|
|
@ -655,9 +655,9 @@ impl<'a, T, U: ?Sized + AsSlice<T>> AsSlice<T> for &'a mut U {
|
|||
fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Default for &'a [T] {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn default() -> &'a [T] { &[] }
|
||||
}
|
||||
|
||||
|
|
@ -668,7 +668,7 @@ impl<'a, T> Default for &'a [T] {
|
|||
// The shared definition of the `Iter` and `IterMut` iterators
|
||||
macro_rules! iterator {
|
||||
(struct $name:ident -> $ptr:ty, $elem:ty) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Iterator for $name<'a, T> {
|
||||
type Item = $elem;
|
||||
|
||||
|
|
@ -706,7 +706,7 @@ macro_rules! iterator {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> DoubleEndedIterator for $name<'a, T> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<$elem> {
|
||||
|
|
@ -748,7 +748,7 @@ macro_rules! make_slice {
|
|||
}
|
||||
|
||||
/// Immutable slice iterator
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, T: 'a> {
|
||||
ptr: *const T,
|
||||
end: *const T,
|
||||
|
|
@ -806,10 +806,10 @@ impl<'a,T> Copy for Iter<'a,T> {}
|
|||
|
||||
iterator!{struct Iter -> *const T, &'a T}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Clone for Iter<'a, T> {
|
||||
fn clone(&self) -> Iter<'a, T> { *self }
|
||||
}
|
||||
|
|
@ -840,7 +840,7 @@ impl<'a, T> RandomAccessIterator for Iter<'a, T> {
|
|||
}
|
||||
|
||||
/// Mutable slice iterator.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IterMut<'a, T: 'a> {
|
||||
ptr: *mut T,
|
||||
end: *mut T,
|
||||
|
|
@ -930,7 +930,7 @@ impl<'a, T> IterMut<'a, T> {
|
|||
|
||||
iterator!{struct IterMut -> *mut T, &'a mut T}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
|
||||
|
||||
/// An internal abstraction over the splitting iterators, so that
|
||||
|
|
@ -943,7 +943,7 @@ trait SplitIter: DoubleEndedIterator {
|
|||
|
||||
/// An iterator over subslices separated by elements that match a predicate
|
||||
/// function.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool {
|
||||
v: &'a [T],
|
||||
pred: P,
|
||||
|
|
@ -951,7 +951,7 @@ pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool {
|
|||
}
|
||||
|
||||
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool {
|
||||
fn clone(&self) -> Split<'a, T, P> {
|
||||
Split {
|
||||
|
|
@ -962,7 +962,7 @@ impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
|
||||
type Item = &'a [T];
|
||||
|
||||
|
|
@ -990,7 +990,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a [T]> {
|
||||
|
|
@ -1016,7 +1016,7 @@ impl<'a, T, P> SplitIter for Split<'a, T, P> where P: FnMut(&T) -> bool {
|
|||
|
||||
/// An iterator over the subslices of the vector which are separated
|
||||
/// by elements that match `pred`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct SplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool {
|
||||
v: &'a mut [T],
|
||||
pred: P,
|
||||
|
|
@ -1035,7 +1035,7 @@ impl<'a, T, P> SplitIter for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
|
||||
type Item = &'a mut [T];
|
||||
|
||||
|
|
@ -1070,7 +1070,7 @@ impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where
|
||||
P: FnMut(&T) -> bool,
|
||||
{
|
||||
|
|
@ -1125,7 +1125,7 @@ impl<T, I: SplitIter<Item=T>> Iterator for GenericSplitN<I> {
|
|||
|
||||
/// An iterator over subslices separated by elements that match a predicate
|
||||
/// function, limited to a given number of splits.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
|
||||
inner: GenericSplitN<Split<'a, T, P>>
|
||||
}
|
||||
|
|
@ -1133,14 +1133,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(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
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(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
|
||||
inner: GenericSplitN<SplitMut<'a, T, P>>
|
||||
}
|
||||
|
|
@ -1148,14 +1148,14 @@ 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(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
|
||||
inner: GenericSplitN<SplitMut<'a, T, P>>
|
||||
}
|
||||
|
||||
macro_rules! forward_iterator {
|
||||
($name:ident: $elem:ident, $iter_of:ty) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, $elem, P> Iterator for $name<'a, $elem, P> where
|
||||
P: FnMut(&T) -> bool
|
||||
{
|
||||
|
|
@ -1181,13 +1181,13 @@ forward_iterator! { RSplitNMut: T, &'a mut [T] }
|
|||
|
||||
/// An iterator over overlapping subslices of length `size`.
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Windows<'a, T:'a> {
|
||||
v: &'a [T],
|
||||
size: uint
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Iterator for Windows<'a, T> {
|
||||
type Item = &'a [T];
|
||||
|
||||
|
|
@ -1219,13 +1219,13 @@ impl<'a, T> Iterator for Windows<'a, T> {
|
|||
/// When the slice len is not evenly divided by the chunk size, the last slice
|
||||
/// of the iteration will be the remainder.
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Chunks<'a, T:'a> {
|
||||
v: &'a [T],
|
||||
size: uint
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Iterator for Chunks<'a, T> {
|
||||
type Item = &'a [T];
|
||||
|
||||
|
|
@ -1254,7 +1254,7 @@ impl<'a, T> Iterator for Chunks<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a [T]> {
|
||||
|
|
@ -1294,13 +1294,13 @@ impl<'a, T> RandomAccessIterator for Chunks<'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.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct ChunksMut<'a, T:'a> {
|
||||
v: &'a mut [T],
|
||||
chunk_size: uint
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Iterator for ChunksMut<'a, T> {
|
||||
type Item = &'a mut [T];
|
||||
|
||||
|
|
@ -1330,7 +1330,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a mut [T]> {
|
||||
|
|
@ -1461,7 +1461,7 @@ pub mod bytes {
|
|||
// Boilerplate traits
|
||||
//
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> {
|
||||
fn eq(&self, other: &[B]) -> bool {
|
||||
self.len() == other.len() &&
|
||||
|
|
@ -1473,17 +1473,17 @@ impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Eq> Eq for [T] {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Ord> Ord for [T] {
|
||||
fn cmp(&self, other: &[T]) -> Ordering {
|
||||
order::cmp(self.iter(), other.iter())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: PartialOrd> PartialOrd for [T] {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &[T]) -> Option<Ordering> {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ macro_rules! delegate_iter {
|
|||
}
|
||||
};
|
||||
($te:ty : $ti:ty) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Iterator for $ti {
|
||||
type Item = $te;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ macro_rules! delegate_iter {
|
|||
self.0.size_hint()
|
||||
}
|
||||
}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> DoubleEndedIterator for $ti {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<$te> {
|
||||
|
|
@ -67,7 +67,7 @@ macro_rules! delegate_iter {
|
|||
}
|
||||
};
|
||||
(pattern $te:ty : $ti:ty) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, P: CharEq> Iterator for $ti {
|
||||
type Item = $te;
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ macro_rules! delegate_iter {
|
|||
self.0.size_hint()
|
||||
}
|
||||
}
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, P: CharEq> DoubleEndedIterator for $ti {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<$te> {
|
||||
|
|
@ -89,7 +89,7 @@ macro_rules! delegate_iter {
|
|||
}
|
||||
};
|
||||
(pattern forward $te:ty : $ti:ty) => {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, P: CharEq> Iterator for $ti {
|
||||
type Item = $te;
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ pub enum Utf8Error {
|
|||
///
|
||||
/// Returns `Err` if the slice is not utf-8 with a description as to why the
|
||||
/// provided slice is not utf-8.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
|
||||
try!(run_utf8_validation_iterator(&mut v.iter()));
|
||||
Ok(unsafe { from_utf8_unchecked(v) })
|
||||
|
|
@ -177,7 +177,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
|
|||
|
||||
/// Converts a slice of bytes to a string slice without checking
|
||||
/// that the string contains valid UTF-8.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str {
|
||||
mem::transmute(v)
|
||||
}
|
||||
|
|
@ -255,7 +255,7 @@ Section: Iterators
|
|||
///
|
||||
/// Created with the method `.chars()`.
|
||||
#[derive(Clone, Copy)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Chars<'a> {
|
||||
iter: slice::Iter<'a, u8>
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ fn unwrap_or_0(opt: Option<&u8>) -> u8 {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Iterator for Chars<'a> {
|
||||
type Item = char;
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ impl<'a> Iterator for Chars<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> DoubleEndedIterator for Chars<'a> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<char> {
|
||||
|
|
@ -367,13 +367,13 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
|
|||
/// External iterator for a string's characters and their byte offsets.
|
||||
/// Use with the `std::iter` module.
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct CharIndices<'a> {
|
||||
front_offset: uint,
|
||||
iter: Chars<'a>,
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Iterator for CharIndices<'a> {
|
||||
type Item = (uint, char);
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ impl<'a> Iterator for CharIndices<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> DoubleEndedIterator for CharIndices<'a> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<(uint, char)> {
|
||||
|
|
@ -416,7 +416,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> {
|
|||
/// Use with the `std::iter` module.
|
||||
///
|
||||
/// Created with `StrExt::bytes`
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Clone)]
|
||||
pub struct Bytes<'a>(Map<&'a u8, u8, slice::Iter<'a, u8>, BytesDeref>);
|
||||
delegate_iter!{exact u8 : Bytes<'a>}
|
||||
|
|
@ -456,13 +456,13 @@ struct CharSplitsN<'a, Sep> {
|
|||
}
|
||||
|
||||
/// An iterator over the lines of a string, separated by `\n`.
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Lines<'a> {
|
||||
inner: CharSplits<'a, char>,
|
||||
}
|
||||
|
||||
/// An iterator over the lines of a string, separated by either `\n` or (`\r\n`).
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct LinesAny<'a> {
|
||||
inner: Map<&'a str, &'a str, Lines<'a>, fn(&str) -> &str>,
|
||||
}
|
||||
|
|
@ -479,7 +479,7 @@ impl<'a, Sep> CharSplits<'a, Sep> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> {
|
||||
type Item = &'a str;
|
||||
|
||||
|
|
@ -514,7 +514,7 @@ impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a str> {
|
||||
|
|
@ -556,7 +556,7 @@ impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, Sep: CharEq> Iterator for CharSplitsN<'a, Sep> {
|
||||
type Item = &'a str;
|
||||
|
||||
|
|
@ -880,7 +880,7 @@ pub struct SplitStr<'a> {
|
|||
finished: bool
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Iterator for MatchIndices<'a> {
|
||||
type Item = (uint, uint);
|
||||
|
||||
|
|
@ -897,7 +897,7 @@ impl<'a> Iterator for MatchIndices<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Iterator for SplitStr<'a> {
|
||||
type Item = &'a str;
|
||||
|
||||
|
|
@ -1084,7 +1084,7 @@ mod traits {
|
|||
use ops;
|
||||
use str::{StrExt, eq_slice};
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Ord for str {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &str) -> Ordering {
|
||||
|
|
@ -1100,7 +1100,7 @@ mod traits {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialEq for str {
|
||||
#[inline]
|
||||
fn eq(&self, other: &str) -> bool {
|
||||
|
|
@ -1110,10 +1110,10 @@ mod traits {
|
|||
fn ne(&self, other: &str) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Eq for str {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialOrd for str {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &str) -> Option<Ordering> {
|
||||
|
|
@ -1173,7 +1173,7 @@ impl<'a, S: ?Sized> Str for &'a S where S: Str {
|
|||
|
||||
/// Return type of `StrExt::split`
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Split<'a, P>(CharSplits<'a, P>);
|
||||
delegate_iter!{pattern &'a str : Split<'a, P>}
|
||||
|
||||
|
|
@ -1186,13 +1186,13 @@ delegate_iter!{pattern &'a str : SplitTerminator<'a, P>}
|
|||
|
||||
/// Return type of `StrExt::splitn`
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct SplitN<'a, P>(CharSplitsN<'a, P>);
|
||||
delegate_iter!{pattern forward &'a str : SplitN<'a, P>}
|
||||
|
||||
/// Return type of `StrExt::rsplitn`
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct RSplitN<'a, P>(CharSplitsN<'a, P>);
|
||||
delegate_iter!{pattern forward &'a str : RSplitN<'a, P>}
|
||||
|
||||
|
|
@ -1607,13 +1607,13 @@ impl StrExt for str {
|
|||
fn parse<T: FromStr>(&self) -> Option<T> { FromStr::from_str(self) }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Default for &'a str {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn default() -> &'a str { "" }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Iterator for Lines<'a> {
|
||||
type Item = &'a str;
|
||||
|
||||
|
|
@ -1623,13 +1623,13 @@ impl<'a> Iterator for Lines<'a> {
|
|||
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> DoubleEndedIterator for Lines<'a> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Iterator for LinesAny<'a> {
|
||||
type Item = &'a str;
|
||||
|
||||
|
|
@ -1639,7 +1639,7 @@ impl<'a> Iterator for LinesAny<'a> {
|
|||
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> DoubleEndedIterator for LinesAny<'a> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() }
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
//! * `Ord`
|
||||
//! * `Default`
|
||||
|
||||
#![stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use clone::Clone;
|
||||
use cmp::*;
|
||||
|
|
@ -55,14 +55,14 @@ macro_rules! tuple_impls {
|
|||
}
|
||||
)+) => {
|
||||
$(
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<$($T:Clone),+> Clone for ($($T,)+) {
|
||||
fn clone(&self) -> ($($T,)+) {
|
||||
($(e!(self.$idx.clone()),)+)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<$($T:PartialEq),+> PartialEq for ($($T,)+) {
|
||||
#[inline]
|
||||
fn eq(&self, other: &($($T,)+)) -> bool {
|
||||
|
|
@ -74,10 +74,10 @@ macro_rules! tuple_impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<$($T:Eq),+> Eq for ($($T,)+) {}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> {
|
||||
|
|
@ -101,7 +101,7 @@ macro_rules! tuple_impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<$($T:Ord),+> Ord for ($($T,)+) {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &($($T,)+)) -> Ordering {
|
||||
|
|
@ -109,9 +109,9 @@ macro_rules! tuple_impls {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<$($T:Default),+> Default for ($($T,)+) {
|
||||
#[stable(feature = "grandfathered", since = "1.0.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
fn default() -> ($($T,)+) {
|
||||
($({ let x: $T = Default::default(); x},)+)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue