std: Add issues to all unstable features
This commit is contained in:
parent
377c11aa83
commit
5f625620b5
|
@ -92,7 +92,8 @@
|
||||||
|
|
||||||
#![doc(hidden)]
|
#![doc(hidden)]
|
||||||
#![unstable(feature = "dec2flt",
|
#![unstable(feature = "dec2flt",
|
||||||
reason = "internal routines only exposed for testing")]
|
reason = "internal routines only exposed for testing",
|
||||||
|
issue = "0")]
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
use num::ParseFloatError as PFE;
|
use num::ParseFloatError as PFE;
|
||||||
|
|
|
@ -117,7 +117,7 @@ pub trait AsciiExt {
|
||||||
///
|
///
|
||||||
/// assert_eq!('A', ascii);
|
/// assert_eq!('A', ascii);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "ascii")]
|
#[unstable(feature = "ascii", issue = "27809")]
|
||||||
fn make_ascii_uppercase(&mut self);
|
fn make_ascii_uppercase(&mut self);
|
||||||
|
|
||||||
/// Converts this type to its ASCII lower case equivalent in-place.
|
/// Converts this type to its ASCII lower case equivalent in-place.
|
||||||
|
@ -137,7 +137,7 @@ pub trait AsciiExt {
|
||||||
///
|
///
|
||||||
/// assert_eq!('a', ascii);
|
/// assert_eq!('a', ascii);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "ascii")]
|
#[unstable(feature = "ascii", issue = "27809")]
|
||||||
fn make_ascii_lowercase(&mut self);
|
fn make_ascii_lowercase(&mut self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -553,7 +553,8 @@ impl<K, V, S> HashMap<K, V, S>
|
||||||
/// map.insert(1, 2);
|
/// map.insert(1, 2);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||||
|
issue = "27713")]
|
||||||
pub fn with_hash_state(hash_state: S) -> HashMap<K, V, S> {
|
pub fn with_hash_state(hash_state: S) -> HashMap<K, V, S> {
|
||||||
HashMap {
|
HashMap {
|
||||||
hash_state: hash_state,
|
hash_state: hash_state,
|
||||||
|
@ -583,7 +584,8 @@ impl<K, V, S> HashMap<K, V, S>
|
||||||
/// map.insert(1, 2);
|
/// map.insert(1, 2);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||||
|
issue = "27713")]
|
||||||
pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
|
pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
|
||||||
-> HashMap<K, V, S> {
|
-> HashMap<K, V, S> {
|
||||||
let resize_policy = DefaultResizePolicy::new();
|
let resize_policy = DefaultResizePolicy::new();
|
||||||
|
@ -998,7 +1000,8 @@ impl<K, V, S> HashMap<K, V, S>
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "drain",
|
#[unstable(feature = "drain",
|
||||||
reason = "matches collection reform specification, waiting for dust to settle")]
|
reason = "matches collection reform specification, waiting for dust to settle",
|
||||||
|
issue = "27711")]
|
||||||
pub fn drain(&mut self) -> Drain<K, V> {
|
pub fn drain(&mut self) -> Drain<K, V> {
|
||||||
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
|
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
|
||||||
let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two; // coerce to fn pointer
|
let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two; // coerce to fn pointer
|
||||||
|
@ -1311,7 +1314,8 @@ impl<'a, K, V> Clone for Values<'a, K, V> {
|
||||||
|
|
||||||
/// HashMap drain iterator.
|
/// HashMap drain iterator.
|
||||||
#[unstable(feature = "drain",
|
#[unstable(feature = "drain",
|
||||||
reason = "matches collection reform specification, waiting for dust to settle")]
|
reason = "matches collection reform specification, waiting for dust to settle",
|
||||||
|
issue = "27711")]
|
||||||
pub struct Drain<'a, K: 'a, V: 'a> {
|
pub struct Drain<'a, K: 'a, V: 'a> {
|
||||||
inner: iter::Map<table::Drain<'a, K, V>, fn((SafeHash, K, V)) -> (K, V)>
|
inner: iter::Map<table::Drain<'a, K, V>, fn((SafeHash, K, V)) -> (K, V)>
|
||||||
}
|
}
|
||||||
|
@ -1587,14 +1591,16 @@ impl<K, V, S> Extend<(K, V)> for HashMap<K, V, S>
|
||||||
/// instances are unlikely to produce the same result for the same values.
|
/// instances are unlikely to produce the same result for the same values.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
#[unstable(feature = "hashmap_hasher",
|
#[unstable(feature = "hashmap_hasher",
|
||||||
reason = "hashing an hash maps may be altered")]
|
reason = "hashing an hash maps may be altered",
|
||||||
|
issue = "27713")]
|
||||||
pub struct RandomState {
|
pub struct RandomState {
|
||||||
k0: u64,
|
k0: u64,
|
||||||
k1: u64,
|
k1: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "hashmap_hasher",
|
#[unstable(feature = "hashmap_hasher",
|
||||||
reason = "hashing an hash maps may be altered")]
|
reason = "hashing an hash maps may be altered",
|
||||||
|
issue = "27713")]
|
||||||
impl RandomState {
|
impl RandomState {
|
||||||
/// Constructs a new `RandomState` that is initialized with random keys.
|
/// Constructs a new `RandomState` that is initialized with random keys.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1606,7 +1612,8 @@ impl RandomState {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "hashmap_hasher",
|
#[unstable(feature = "hashmap_hasher",
|
||||||
reason = "hashing an hash maps may be altered")]
|
reason = "hashing an hash maps may be altered",
|
||||||
|
issue = "27713")]
|
||||||
impl HashState for RandomState {
|
impl HashState for RandomState {
|
||||||
type Hasher = SipHasher;
|
type Hasher = SipHasher;
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -164,7 +164,8 @@ impl<T, S> HashSet<T, S>
|
||||||
/// set.insert(2);
|
/// set.insert(2);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||||
|
issue = "27713")]
|
||||||
pub fn with_hash_state(hash_state: S) -> HashSet<T, S> {
|
pub fn with_hash_state(hash_state: S) -> HashSet<T, S> {
|
||||||
HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state)
|
HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state)
|
||||||
}
|
}
|
||||||
|
@ -190,7 +191,8 @@ impl<T, S> HashSet<T, S>
|
||||||
/// set.insert(1);
|
/// set.insert(1);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||||
|
issue = "27713")]
|
||||||
pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
|
pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
|
||||||
-> HashSet<T, S> {
|
-> HashSet<T, S> {
|
||||||
HashSet {
|
HashSet {
|
||||||
|
@ -411,7 +413,8 @@ impl<T, S> HashSet<T, S>
|
||||||
/// Clears the set, returning all elements in an iterator.
|
/// Clears the set, returning all elements in an iterator.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "drain",
|
#[unstable(feature = "drain",
|
||||||
reason = "matches collection reform specification, waiting for dust to settle")]
|
reason = "matches collection reform specification, waiting for dust to settle",
|
||||||
|
issue = "27711")]
|
||||||
pub fn drain(&mut self) -> Drain<T> {
|
pub fn drain(&mut self) -> Drain<T> {
|
||||||
fn first<A, B>((a, _): (A, B)) -> A { a }
|
fn first<A, B>((a, _): (A, B)) -> A { a }
|
||||||
let first: fn((T, ())) -> T = first; // coerce to fn pointer
|
let first: fn((T, ())) -> T = first; // coerce to fn pointer
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
#![unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||||
|
issue = "27713")]
|
||||||
|
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
use default::Default;
|
use default::Default;
|
||||||
|
|
|
@ -410,7 +410,8 @@ pub mod hash_set {
|
||||||
|
|
||||||
/// Experimental support for providing custom hash algorithms to a HashMap and
|
/// Experimental support for providing custom hash algorithms to a HashMap and
|
||||||
/// HashSet.
|
/// HashSet.
|
||||||
#[unstable(feature = "hashmap_hasher", reason = "module was recently added")]
|
#[unstable(feature = "hashmap_hasher", reason = "module was recently added",
|
||||||
|
issue = "27713")]
|
||||||
pub mod hash_state {
|
pub mod hash_state {
|
||||||
pub use super::hash::state::*;
|
pub use super::hash::state::*;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
#![unstable(feature = "dynamic_lib",
|
#![unstable(feature = "dynamic_lib",
|
||||||
reason = "API has not been scrutinized and is highly likely to \
|
reason = "API has not been scrutinized and is highly likely to \
|
||||||
either disappear or change")]
|
either disappear or change",
|
||||||
|
issue = "27810")]
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
|
@ -78,7 +78,8 @@ pub trait Error: Debug + Display + Reflect {
|
||||||
/// Get the `TypeId` of `self`
|
/// Get the `TypeId` of `self`
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[unstable(feature = "error_type_id",
|
#[unstable(feature = "error_type_id",
|
||||||
reason = "unclear whether to commit to this public implementation detail")]
|
reason = "unclear whether to commit to this public implementation detail",
|
||||||
|
issue = "27745")]
|
||||||
fn type_id(&self) -> TypeId where Self: 'static {
|
fn type_id(&self) -> TypeId where Self: 'static {
|
||||||
TypeId::of::<Self>()
|
TypeId::of::<Self>()
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,8 @@ impl CString {
|
||||||
/// The only appropriate argument is a pointer obtained by calling
|
/// The only appropriate argument is a pointer obtained by calling
|
||||||
/// `into_ptr`. The length of the string will be recalculated
|
/// `into_ptr`. The length of the string will be recalculated
|
||||||
/// using the pointer.
|
/// using the pointer.
|
||||||
#[unstable(feature = "cstr_memory", reason = "recently added")]
|
#[unstable(feature = "cstr_memory", reason = "recently added",
|
||||||
|
issue = "27769")]
|
||||||
// NB: may want to be called from_raw, needs to consider CStr::from_ptr,
|
// NB: may want to be called from_raw, needs to consider CStr::from_ptr,
|
||||||
// Box::from_raw (or whatever it's currently called), and
|
// Box::from_raw (or whatever it's currently called), and
|
||||||
// slice::from_raw_parts
|
// slice::from_raw_parts
|
||||||
|
@ -223,7 +224,8 @@ impl CString {
|
||||||
/// this string.
|
/// this string.
|
||||||
///
|
///
|
||||||
/// Failure to call `from_ptr` will lead to a memory leak.
|
/// Failure to call `from_ptr` will lead to a memory leak.
|
||||||
#[unstable(feature = "cstr_memory", reason = "recently added")]
|
#[unstable(feature = "cstr_memory", reason = "recently added",
|
||||||
|
issue = "27769")]
|
||||||
// NB: may want to be called into_raw, see comments on from_ptr
|
// NB: may want to be called into_raw, see comments on from_ptr
|
||||||
pub fn into_ptr(self) -> *const libc::c_char {
|
pub fn into_ptr(self) -> *const libc::c_char {
|
||||||
// It is important that the bytes be sized to fit - we need
|
// It is important that the bytes be sized to fit - we need
|
||||||
|
@ -407,11 +409,13 @@ impl CStr {
|
||||||
/// > after a 0-cost cast, but it is planned to alter its definition in the
|
/// > after a 0-cost cast, but it is planned to alter its definition in the
|
||||||
/// > future to perform the length calculation in addition to the UTF-8
|
/// > future to perform the length calculation in addition to the UTF-8
|
||||||
/// > check whenever this method is called.
|
/// > check whenever this method is called.
|
||||||
#[unstable(feature = "cstr_to_str", reason = "recently added")]
|
#[unstable(feature = "cstr_to_str", reason = "recently added",
|
||||||
|
issue = "27764")]
|
||||||
pub fn to_str(&self) -> Result<&str, str::Utf8Error> {
|
pub fn to_str(&self) -> Result<&str, str::Utf8Error> {
|
||||||
// NB: When CStr is changed to perform the length check in .to_bytes() instead of in
|
// NB: When CStr is changed to perform the length check in .to_bytes()
|
||||||
// from_ptr(), it may be worth considering if this should be rewritten to do the UTF-8
|
// instead of in from_ptr(), it may be worth considering if this should
|
||||||
// check inline with the length calculation instead of doing it afterwards.
|
// be rewritten to do the UTF-8 check inline with the length calculation
|
||||||
|
// instead of doing it afterwards.
|
||||||
str::from_utf8(self.to_bytes())
|
str::from_utf8(self.to_bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +430,8 @@ impl CStr {
|
||||||
/// > after a 0-cost cast, but it is planned to alter its definition in the
|
/// > after a 0-cost cast, but it is planned to alter its definition in the
|
||||||
/// > future to perform the length calculation in addition to the UTF-8
|
/// > future to perform the length calculation in addition to the UTF-8
|
||||||
/// > check whenever this method is called.
|
/// > check whenever this method is called.
|
||||||
#[unstable(feature = "cstr_to_str", reason = "recently added")]
|
#[unstable(feature = "cstr_to_str", reason = "recently added",
|
||||||
|
issue = "27764")]
|
||||||
pub fn to_string_lossy(&self) -> Cow<str> {
|
pub fn to_string_lossy(&self) -> Cow<str> {
|
||||||
String::from_utf8_lossy(self.to_bytes())
|
String::from_utf8_lossy(self.to_bytes())
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,6 @@
|
||||||
//! for conversion to/from various other string types. Eventually these types
|
//! for conversion to/from various other string types. Eventually these types
|
||||||
//! will offer a full-fledged string API.
|
//! will offer a full-fledged string API.
|
||||||
|
|
||||||
#![unstable(feature = "os_str",
|
|
||||||
reason = "recently added as part of path/io reform")]
|
|
||||||
|
|
||||||
use borrow::{Borrow, Cow, ToOwned};
|
use borrow::{Borrow, Cow, ToOwned};
|
||||||
use ffi::CString;
|
use ffi::CString;
|
||||||
use fmt::{self, Debug};
|
use fmt::{self, Debug};
|
||||||
|
@ -74,7 +71,7 @@ impl OsString {
|
||||||
///
|
///
|
||||||
/// On Windows system, only UTF-8 byte sequences will successfully
|
/// On Windows system, only UTF-8 byte sequences will successfully
|
||||||
/// convert; non UTF-8 data will produce `None`.
|
/// convert; non UTF-8 data will produce `None`.
|
||||||
#[unstable(feature = "convert", reason = "recently added")]
|
#[unstable(feature = "convert", reason = "recently added", issue = "27704")]
|
||||||
pub fn from_bytes<B>(bytes: B) -> Option<OsString> where B: Into<Vec<u8>> {
|
pub fn from_bytes<B>(bytes: B) -> Option<OsString> where B: Into<Vec<u8>> {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn from_bytes_inner(vec: Vec<u8>) -> Option<OsString> {
|
fn from_bytes_inner(vec: Vec<u8>) -> Option<OsString> {
|
||||||
|
@ -258,7 +255,7 @@ impl OsStr {
|
||||||
/// On Windows systems, this returns `None` unless the `OsStr` is
|
/// On Windows systems, this returns `None` unless the `OsStr` is
|
||||||
/// valid unicode, in which case it produces UTF-8-encoded
|
/// valid unicode, in which case it produces UTF-8-encoded
|
||||||
/// data. This may entail checking validity.
|
/// data. This may entail checking validity.
|
||||||
#[unstable(feature = "convert", reason = "recently added")]
|
#[unstable(feature = "convert", reason = "recently added", issue = "27704")]
|
||||||
pub fn to_bytes(&self) -> Option<&[u8]> {
|
pub fn to_bytes(&self) -> Option<&[u8]> {
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
self.to_str().map(|s| s.as_bytes())
|
self.to_str().map(|s| s.as_bytes())
|
||||||
|
@ -274,7 +271,7 @@ impl OsStr {
|
||||||
/// This is a convenience for creating a `CString` from
|
/// This is a convenience for creating a `CString` from
|
||||||
/// `self.to_bytes()`, and inherits the platform behavior of the
|
/// `self.to_bytes()`, and inherits the platform behavior of the
|
||||||
/// `to_bytes` method.
|
/// `to_bytes` method.
|
||||||
#[unstable(feature = "convert", reason = "recently added")]
|
#[unstable(feature = "convert", reason = "recently added", issue = "27704")]
|
||||||
pub fn to_cstring(&self) -> Option<CString> {
|
pub fn to_cstring(&self) -> Option<CString> {
|
||||||
self.to_bytes().and_then(|b| CString::new(b).ok())
|
self.to_bytes().and_then(|b| CString::new(b).ok())
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,8 @@ pub struct DirEntry(fs_imp::DirEntry);
|
||||||
#[unstable(feature = "fs_walk",
|
#[unstable(feature = "fs_walk",
|
||||||
reason = "the precise semantics and defaults for a recursive walk \
|
reason = "the precise semantics and defaults for a recursive walk \
|
||||||
may change and this may end up accounting for files such \
|
may change and this may end up accounting for files such \
|
||||||
as symlinks differently")]
|
as symlinks differently",
|
||||||
|
issue = "27707")]
|
||||||
pub struct WalkDir {
|
pub struct WalkDir {
|
||||||
cur: Option<ReadDir>,
|
cur: Option<ReadDir>,
|
||||||
stack: Vec<io::Result<ReadDir>>,
|
stack: Vec<io::Result<ReadDir>>,
|
||||||
|
@ -154,7 +155,8 @@ pub struct FileType(fs_imp::FileType);
|
||||||
/// A builder used to create directories in various manners.
|
/// A builder used to create directories in various manners.
|
||||||
///
|
///
|
||||||
/// This builder also supports platform-specific options.
|
/// This builder also supports platform-specific options.
|
||||||
#[unstable(feature = "dir_builder", reason = "recently added API")]
|
#[unstable(feature = "dir_builder", reason = "recently added API",
|
||||||
|
issue = "27710")]
|
||||||
pub struct DirBuilder {
|
pub struct DirBuilder {
|
||||||
inner: fs_imp::DirBuilder,
|
inner: fs_imp::DirBuilder,
|
||||||
recursive: bool,
|
recursive: bool,
|
||||||
|
@ -949,7 +951,8 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
||||||
|
|
||||||
/// Returns the canonical form of a path with all intermediate components
|
/// Returns the canonical form of a path with all intermediate components
|
||||||
/// normalized and symbolic links resolved.
|
/// normalized and symbolic links resolved.
|
||||||
#[unstable(feature = "fs_canonicalize", reason = "recently added API")]
|
#[unstable(feature = "fs_canonicalize", reason = "recently added API",
|
||||||
|
issue = "27706")]
|
||||||
pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
||||||
fs_imp::canonicalize(path.as_ref())
|
fs_imp::canonicalize(path.as_ref())
|
||||||
}
|
}
|
||||||
|
@ -1107,13 +1110,14 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
|
||||||
#[unstable(feature = "fs_walk",
|
#[unstable(feature = "fs_walk",
|
||||||
reason = "the precise semantics and defaults for a recursive walk \
|
reason = "the precise semantics and defaults for a recursive walk \
|
||||||
may change and this may end up accounting for files such \
|
may change and this may end up accounting for files such \
|
||||||
as symlinks differently")]
|
as symlinks differently",
|
||||||
|
issue = "27707")]
|
||||||
pub fn walk_dir<P: AsRef<Path>>(path: P) -> io::Result<WalkDir> {
|
pub fn walk_dir<P: AsRef<Path>>(path: P) -> io::Result<WalkDir> {
|
||||||
let start = try!(read_dir(path));
|
let start = try!(read_dir(path));
|
||||||
Ok(WalkDir { cur: Some(start), stack: Vec::new() })
|
Ok(WalkDir { cur: Some(start), stack: Vec::new() })
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "fs_walk")]
|
#[unstable(feature = "fs_walk", issue = "27707")]
|
||||||
impl Iterator for WalkDir {
|
impl Iterator for WalkDir {
|
||||||
type Item = io::Result<DirEntry>;
|
type Item = io::Result<DirEntry>;
|
||||||
|
|
||||||
|
@ -1146,7 +1150,8 @@ impl Iterator for WalkDir {
|
||||||
#[unstable(feature = "path_ext",
|
#[unstable(feature = "path_ext",
|
||||||
reason = "The precise set of methods exposed on this trait may \
|
reason = "The precise set of methods exposed on this trait may \
|
||||||
change and some methods may be removed. For stable code, \
|
change and some methods may be removed. For stable code, \
|
||||||
see the std::fs::metadata function.")]
|
see the std::fs::metadata function.",
|
||||||
|
issue = "27725")]
|
||||||
pub trait PathExt {
|
pub trait PathExt {
|
||||||
/// Gets information on the file, directory, etc at this path.
|
/// Gets information on the file, directory, etc at this path.
|
||||||
///
|
///
|
||||||
|
@ -1242,7 +1247,8 @@ pub fn set_permissions<P: AsRef<Path>>(path: P, perm: Permissions)
|
||||||
fs_imp::set_perm(path.as_ref(), perm.0)
|
fs_imp::set_perm(path.as_ref(), perm.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "dir_builder", reason = "recently added API")]
|
#[unstable(feature = "dir_builder", reason = "recently added API",
|
||||||
|
issue = "27710")]
|
||||||
impl DirBuilder {
|
impl DirBuilder {
|
||||||
/// Creates a new set of options with default mode/security settings for all
|
/// Creates a new set of options with default mode/security settings for all
|
||||||
/// platforms and also non-recursive.
|
/// platforms and also non-recursive.
|
||||||
|
|
|
@ -150,7 +150,8 @@ pub enum ErrorKind {
|
||||||
/// Any I/O error not part of this list.
|
/// Any I/O error not part of this list.
|
||||||
#[unstable(feature = "io_error_internals",
|
#[unstable(feature = "io_error_internals",
|
||||||
reason = "better expressed through extensible enums that this \
|
reason = "better expressed through extensible enums that this \
|
||||||
enum cannot be exhaustively matched against")]
|
enum cannot be exhaustively matched against",
|
||||||
|
issue = "0")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
__Nonexhaustive,
|
__Nonexhaustive,
|
||||||
}
|
}
|
||||||
|
|
|
@ -647,7 +647,8 @@ pub trait Read {
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
||||||
of where errors happen is currently \
|
of where errors happen is currently \
|
||||||
unclear and may change")]
|
unclear and may change",
|
||||||
|
issue = "27802")]
|
||||||
fn chars(self) -> Chars<Self> where Self: Sized {
|
fn chars(self) -> Chars<Self> where Self: Sized {
|
||||||
Chars { inner: self }
|
Chars { inner: self }
|
||||||
}
|
}
|
||||||
|
@ -754,7 +755,8 @@ pub trait Read {
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
||||||
of where errors happen is currently \
|
of where errors happen is currently \
|
||||||
unclear and may change")]
|
unclear and may change",
|
||||||
|
issue = "27802")]
|
||||||
fn tee<W: Write>(self, out: W) -> Tee<Self, W> where Self: Sized {
|
fn tee<W: Write>(self, out: W) -> Tee<Self, W> where Self: Sized {
|
||||||
Tee { reader: self, writer: out }
|
Tee { reader: self, writer: out }
|
||||||
}
|
}
|
||||||
|
@ -1016,7 +1018,8 @@ pub trait Write {
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
||||||
of where errors happen is currently \
|
of where errors happen is currently \
|
||||||
unclear and may change")]
|
unclear and may change",
|
||||||
|
issue = "27802")]
|
||||||
fn broadcast<W: Write>(self, other: W) -> Broadcast<Self, W>
|
fn broadcast<W: Write>(self, other: W) -> Broadcast<Self, W>
|
||||||
where Self: Sized
|
where Self: Sized
|
||||||
{
|
{
|
||||||
|
@ -1401,13 +1404,15 @@ pub trait BufRead: Read {
|
||||||
/// writer. Please see the documentation of `broadcast()` for more details.
|
/// writer. Please see the documentation of `broadcast()` for more details.
|
||||||
///
|
///
|
||||||
/// [broadcast]: trait.Write.html#method.broadcast
|
/// [broadcast]: trait.Write.html#method.broadcast
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast")]
|
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast",
|
||||||
|
issue = "27802")]
|
||||||
pub struct Broadcast<T, U> {
|
pub struct Broadcast<T, U> {
|
||||||
first: T,
|
first: T,
|
||||||
second: U,
|
second: U,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast")]
|
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast",
|
||||||
|
issue = "27802")]
|
||||||
impl<T: Write, U: Write> Write for Broadcast<T, U> {
|
impl<T: Write, U: Write> Write for Broadcast<T, U> {
|
||||||
fn write(&mut self, data: &[u8]) -> Result<usize> {
|
fn write(&mut self, data: &[u8]) -> Result<usize> {
|
||||||
let n = try!(self.first.write(data));
|
let n = try!(self.first.write(data));
|
||||||
|
@ -1509,13 +1514,15 @@ impl<T: BufRead> BufRead for Take<T> {
|
||||||
/// Please see the documentation of `tee()` for more details.
|
/// Please see the documentation of `tee()` for more details.
|
||||||
///
|
///
|
||||||
/// [tee]: trait.Read.html#method.tee
|
/// [tee]: trait.Read.html#method.tee
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Read::tee")]
|
#[unstable(feature = "io", reason = "awaiting stability of Read::tee",
|
||||||
|
issue = "27802")]
|
||||||
pub struct Tee<R, W> {
|
pub struct Tee<R, W> {
|
||||||
reader: R,
|
reader: R,
|
||||||
writer: W,
|
writer: W,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Read::tee")]
|
#[unstable(feature = "io", reason = "awaiting stability of Read::tee",
|
||||||
|
issue = "27802")]
|
||||||
impl<R: Read, W: Write> Read for Tee<R, W> {
|
impl<R: Read, W: Write> Read for Tee<R, W> {
|
||||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
|
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
|
||||||
let n = try!(self.reader.read(buf));
|
let n = try!(self.reader.read(buf));
|
||||||
|
@ -1556,7 +1563,8 @@ impl<R: Read> Iterator for Bytes<R> {
|
||||||
/// Please see the documentation of `chars()` for more details.
|
/// Please see the documentation of `chars()` for more details.
|
||||||
///
|
///
|
||||||
/// [chars]: trait.Read.html#method.chars
|
/// [chars]: trait.Read.html#method.chars
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||||
|
issue = "27802")]
|
||||||
pub struct Chars<R> {
|
pub struct Chars<R> {
|
||||||
inner: R,
|
inner: R,
|
||||||
}
|
}
|
||||||
|
@ -1564,7 +1572,8 @@ pub struct Chars<R> {
|
||||||
/// An enumeration of possible errors that can be generated from the `Chars`
|
/// An enumeration of possible errors that can be generated from the `Chars`
|
||||||
/// adapter.
|
/// adapter.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||||
|
issue = "27802")]
|
||||||
pub enum CharsError {
|
pub enum CharsError {
|
||||||
/// Variant representing that the underlying stream was read successfully
|
/// Variant representing that the underlying stream was read successfully
|
||||||
/// but it did not contain valid utf8 data.
|
/// but it did not contain valid utf8 data.
|
||||||
|
@ -1574,7 +1583,8 @@ pub enum CharsError {
|
||||||
Other(Error),
|
Other(Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||||
|
issue = "27802")]
|
||||||
impl<R: Read> Iterator for Chars<R> {
|
impl<R: Read> Iterator for Chars<R> {
|
||||||
type Item = result::Result<char, CharsError>;
|
type Item = result::Result<char, CharsError>;
|
||||||
|
|
||||||
|
@ -1606,7 +1616,8 @@ impl<R: Read> Iterator for Chars<R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||||
|
issue = "27802")]
|
||||||
impl std_error::Error for CharsError {
|
impl std_error::Error for CharsError {
|
||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -1622,7 +1633,8 @@ impl std_error::Error for CharsError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||||
|
issue = "27802")]
|
||||||
impl fmt::Display for CharsError {
|
impl fmt::Display for CharsError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
|
@ -531,7 +531,8 @@ impl<'a> Write for StderrLock<'a> {
|
||||||
/// output handle is to the process's stderr stream.
|
/// output handle is to the process's stderr stream.
|
||||||
#[unstable(feature = "set_stdio",
|
#[unstable(feature = "set_stdio",
|
||||||
reason = "this function may disappear completely or be replaced \
|
reason = "this function may disappear completely or be replaced \
|
||||||
with a more general mechanism")]
|
with a more general mechanism",
|
||||||
|
issue = "0")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn set_panic(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
pub fn set_panic(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
||||||
use panicking::LOCAL_STDERR;
|
use panicking::LOCAL_STDERR;
|
||||||
|
@ -554,7 +555,8 @@ pub fn set_panic(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
||||||
/// output handle is to the process's stdout stream.
|
/// output handle is to the process's stdout stream.
|
||||||
#[unstable(feature = "set_stdio",
|
#[unstable(feature = "set_stdio",
|
||||||
reason = "this function may disappear completely or be replaced \
|
reason = "this function may disappear completely or be replaced \
|
||||||
with a more general mechanism")]
|
with a more general mechanism",
|
||||||
|
issue = "0")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn set_print(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
pub fn set_print(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
||||||
use mem;
|
use mem;
|
||||||
|
@ -567,7 +569,8 @@ pub fn set_print(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "print",
|
#[unstable(feature = "print",
|
||||||
reason = "implementation detail which may disappear or be replaced at any time")]
|
reason = "implementation detail which may disappear or be replaced at any time",
|
||||||
|
issue = "0")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn _print(args: fmt::Arguments) {
|
pub fn _print(args: fmt::Arguments) {
|
||||||
let result = LOCAL_STDOUT.with(|s| {
|
let result = LOCAL_STDOUT.with(|s| {
|
||||||
|
|
|
@ -398,7 +398,7 @@ mod rand;
|
||||||
// but it may be stabilized long-term. As a result we're exposing a hidden,
|
// but it may be stabilized long-term. As a result we're exposing a hidden,
|
||||||
// unstable module so we can get our build working.
|
// unstable module so we can get our build working.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[unstable(feature = "rand")]
|
#[unstable(feature = "rand", issue = "0")]
|
||||||
pub mod __rand {
|
pub mod __rand {
|
||||||
pub use rand::{thread_rng, ThreadRng, Rng};
|
pub use rand::{thread_rng, ThreadRng, Rng};
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub struct SocketAddrV6 { inner: libc::sockaddr_in6 }
|
||||||
|
|
||||||
impl SocketAddr {
|
impl SocketAddr {
|
||||||
/// Creates a new socket address from the (ip, port) pair.
|
/// Creates a new socket address from the (ip, port) pair.
|
||||||
#[unstable(feature = "ip_addr", reason = "recent addition")]
|
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
|
||||||
pub fn new(ip: IpAddr, port: u16) -> SocketAddr {
|
pub fn new(ip: IpAddr, port: u16) -> SocketAddr {
|
||||||
match ip {
|
match ip {
|
||||||
IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
|
IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
|
||||||
|
@ -57,7 +57,7 @@ impl SocketAddr {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the IP address associated with this socket address.
|
/// Returns the IP address associated with this socket address.
|
||||||
#[unstable(feature = "ip_addr", reason = "recent addition")]
|
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
|
||||||
pub fn ip(&self) -> IpAddr {
|
pub fn ip(&self) -> IpAddr {
|
||||||
match *self {
|
match *self {
|
||||||
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
|
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
|
|
||||||
#![unstable(feature = "ip", reason = "extra functionality has not been \
|
#![unstable(feature = "ip", reason = "extra functionality has not been \
|
||||||
scrutinized to the level that it should \
|
scrutinized to the level that it should \
|
||||||
be stable")]
|
be stable",
|
||||||
|
issue = "27709")]
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ use sys_common::{AsInner, FromInner};
|
||||||
use net::{hton, ntoh};
|
use net::{hton, ntoh};
|
||||||
|
|
||||||
/// An IP address, either a IPv4 or IPv6 address.
|
/// An IP address, either a IPv4 or IPv6 address.
|
||||||
#[unstable(feature = "ip_addr", reason = "recent addition")]
|
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)]
|
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)]
|
||||||
pub enum IpAddr {
|
pub enum IpAddr {
|
||||||
/// Representation of an IPv4 address.
|
/// Representation of an IPv4 address.
|
||||||
|
|
|
@ -84,12 +84,14 @@ fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
|
||||||
/// An iterator over `SocketAddr` values returned from a host lookup operation.
|
/// An iterator over `SocketAddr` values returned from a host lookup operation.
|
||||||
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
||||||
iterator and returning socket \
|
iterator and returning socket \
|
||||||
addresses")]
|
addresses",
|
||||||
|
issue = "27705")]
|
||||||
pub struct LookupHost(net_imp::LookupHost);
|
pub struct LookupHost(net_imp::LookupHost);
|
||||||
|
|
||||||
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
||||||
iterator and returning socket \
|
iterator and returning socket \
|
||||||
addresses")]
|
addresses",
|
||||||
|
issue = "27705")]
|
||||||
impl Iterator for LookupHost {
|
impl Iterator for LookupHost {
|
||||||
type Item = io::Result<SocketAddr>;
|
type Item = io::Result<SocketAddr>;
|
||||||
fn next(&mut self) -> Option<io::Result<SocketAddr>> { self.0.next() }
|
fn next(&mut self) -> Option<io::Result<SocketAddr>> { self.0.next() }
|
||||||
|
@ -116,7 +118,8 @@ impl Iterator for LookupHost {
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
||||||
iterator and returning socket \
|
iterator and returning socket \
|
||||||
addresses")]
|
addresses",
|
||||||
|
issue = "27705")]
|
||||||
pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
|
pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
|
||||||
net_imp::lookup_host(host).map(LookupHost)
|
net_imp::lookup_host(host).map(LookupHost)
|
||||||
}
|
}
|
||||||
|
@ -126,7 +129,8 @@ pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
|
||||||
/// This function may perform a DNS query to resolve `addr` and may also inspect
|
/// This function may perform a DNS query to resolve `addr` and may also inspect
|
||||||
/// system configuration to resolve the specified address. If the address
|
/// system configuration to resolve the specified address. If the address
|
||||||
/// cannot be resolved, it is returned in string format.
|
/// cannot be resolved, it is returned in string format.
|
||||||
#[unstable(feature = "lookup_addr", reason = "recent addition")]
|
#[unstable(feature = "lookup_addr", reason = "recent addition",
|
||||||
|
issue = "27705")]
|
||||||
pub fn lookup_addr(addr: &IpAddr) -> io::Result<String> {
|
pub fn lookup_addr(addr: &IpAddr) -> io::Result<String> {
|
||||||
net_imp::lookup_addr(addr)
|
net_imp::lookup_addr(addr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![unstable(feature = "tcp", reason = "remaining functions have not been \
|
|
||||||
scrutinized enough to be stabilized")]
|
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
use io::prelude::*;
|
use io::prelude::*;
|
||||||
|
|
||||||
|
@ -133,7 +130,8 @@ impl TcpStream {
|
||||||
/// If the value specified is `None`, then `read` calls will block
|
/// If the value specified is `None`, then `read` calls will block
|
||||||
/// indefinitely. It is an error to pass the zero `Duration` to this
|
/// indefinitely. It is an error to pass the zero `Duration` to this
|
||||||
/// method.
|
/// method.
|
||||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||||
|
issue = "27773")]
|
||||||
pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
||||||
self.0.set_read_timeout(dur)
|
self.0.set_read_timeout(dur)
|
||||||
}
|
}
|
||||||
|
@ -143,7 +141,8 @@ impl TcpStream {
|
||||||
/// If the value specified is `None`, then `write` calls will block
|
/// If the value specified is `None`, then `write` calls will block
|
||||||
/// indefinitely. It is an error to pass the zero `Duration` to this
|
/// indefinitely. It is an error to pass the zero `Duration` to this
|
||||||
/// method.
|
/// method.
|
||||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||||
|
issue = "27773")]
|
||||||
pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
||||||
self.0.set_write_timeout(dur)
|
self.0.set_write_timeout(dur)
|
||||||
}
|
}
|
||||||
|
@ -155,7 +154,8 @@ impl TcpStream {
|
||||||
/// # Note
|
/// # Note
|
||||||
///
|
///
|
||||||
/// Some platforms do not provide access to the current timeout.
|
/// Some platforms do not provide access to the current timeout.
|
||||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||||
|
issue = "27773")]
|
||||||
pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
|
pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
|
||||||
self.0.read_timeout()
|
self.0.read_timeout()
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,8 @@ impl TcpStream {
|
||||||
/// # Note
|
/// # Note
|
||||||
///
|
///
|
||||||
/// Some platforms do not provide access to the current timeout.
|
/// Some platforms do not provide access to the current timeout.
|
||||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||||
|
issue = "27773")]
|
||||||
pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
|
pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
|
||||||
self.0.write_timeout()
|
self.0.write_timeout()
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![unstable(feature = "udp", reason = "remaining functions have not been \
|
|
||||||
scrutinized enough to be stabilized")]
|
|
||||||
|
|
||||||
use fmt;
|
use fmt;
|
||||||
use io::{self, Error, ErrorKind};
|
use io::{self, Error, ErrorKind};
|
||||||
use net::{ToSocketAddrs, SocketAddr};
|
use net::{ToSocketAddrs, SocketAddr};
|
||||||
|
@ -100,7 +97,8 @@ impl UdpSocket {
|
||||||
/// If the value specified is `None`, then `read` calls will block
|
/// If the value specified is `None`, then `read` calls will block
|
||||||
/// indefinitely. It is an error to pass the zero `Duration` to this
|
/// indefinitely. It is an error to pass the zero `Duration` to this
|
||||||
/// method.
|
/// method.
|
||||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||||
|
issue = "27773")]
|
||||||
pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
||||||
self.0.set_read_timeout(dur)
|
self.0.set_read_timeout(dur)
|
||||||
}
|
}
|
||||||
|
@ -110,7 +108,8 @@ impl UdpSocket {
|
||||||
/// If the value specified is `None`, then `write` calls will block
|
/// If the value specified is `None`, then `write` calls will block
|
||||||
/// indefinitely. It is an error to pass the zero `Duration` to this
|
/// indefinitely. It is an error to pass the zero `Duration` to this
|
||||||
/// method.
|
/// method.
|
||||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||||
|
issue = "27773")]
|
||||||
pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
||||||
self.0.set_write_timeout(dur)
|
self.0.set_write_timeout(dur)
|
||||||
}
|
}
|
||||||
|
@ -118,7 +117,8 @@ impl UdpSocket {
|
||||||
/// Returns the read timeout of this socket.
|
/// Returns the read timeout of this socket.
|
||||||
///
|
///
|
||||||
/// If the timeout is `None`, then `read` calls will block indefinitely.
|
/// If the timeout is `None`, then `read` calls will block indefinitely.
|
||||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||||
|
issue = "27773")]
|
||||||
pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
|
pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
|
||||||
self.0.read_timeout()
|
self.0.read_timeout()
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,8 @@ impl UdpSocket {
|
||||||
/// Returns the write timeout of this socket.
|
/// Returns the write timeout of this socket.
|
||||||
///
|
///
|
||||||
/// If the timeout is `None`, then `write` calls will block indefinitely.
|
/// If the timeout is `None`, then `write` calls will block indefinitely.
|
||||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||||
|
issue = "27773")]
|
||||||
pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
|
pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
|
||||||
self.0.write_timeout()
|
self.0.write_timeout()
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,8 @@ mod cmath {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl f32 {
|
impl f32 {
|
||||||
/// Parses a float as with a given radix
|
/// Parses a float as with a given radix
|
||||||
#[unstable(feature = "float_from_str_radix", reason = "recently moved API")]
|
#[unstable(feature = "float_from_str_radix", reason = "recently moved API",
|
||||||
|
issue = "27736")]
|
||||||
pub fn from_str_radix(s: &str, radix: u32) -> Result<f32, ParseFloatError> {
|
pub fn from_str_radix(s: &str, radix: u32) -> Result<f32, ParseFloatError> {
|
||||||
num::Float::from_str_radix(s, radix)
|
num::Float::from_str_radix(s, radix)
|
||||||
}
|
}
|
||||||
|
@ -251,7 +252,8 @@ impl f32 {
|
||||||
/// assert!(abs_difference <= f32::EPSILON);
|
/// assert!(abs_difference <= f32::EPSILON);
|
||||||
/// ```
|
/// ```
|
||||||
/// [floating-point]: ../../../../../reference.html#machine-types
|
/// [floating-point]: ../../../../../reference.html#machine-types
|
||||||
#[unstable(feature = "float_extras", reason = "signature is undecided")]
|
#[unstable(feature = "float_extras", reason = "signature is undecided",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn integer_decode(self) -> (u64, i16, i8) {
|
pub fn integer_decode(self) -> (u64, i16, i8) {
|
||||||
num::Float::integer_decode(self)
|
num::Float::integer_decode(self)
|
||||||
|
@ -607,7 +609,8 @@ impl f32 {
|
||||||
///
|
///
|
||||||
/// assert!(abs_difference <= f32::EPSILON);
|
/// assert!(abs_difference <= f32::EPSILON);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_extras", reason = "desirability is unclear")]
|
#[unstable(feature = "float_extras", reason = "desirability is unclear",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) }
|
pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) }
|
||||||
|
|
||||||
|
@ -624,7 +627,8 @@ impl f32 {
|
||||||
///
|
///
|
||||||
/// assert!(abs_difference <= f32::EPSILON);
|
/// assert!(abs_difference <= f32::EPSILON);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_extras", reason = "desirability is unclear")]
|
#[unstable(feature = "float_extras", reason = "desirability is unclear",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_radians(self) -> f32 { num::Float::to_radians(self) }
|
pub fn to_radians(self) -> f32 { num::Float::to_radians(self) }
|
||||||
|
|
||||||
|
@ -640,7 +644,8 @@ impl f32 {
|
||||||
/// assert!(abs_difference <= f32::EPSILON);
|
/// assert!(abs_difference <= f32::EPSILON);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_extras",
|
#[unstable(feature = "float_extras",
|
||||||
reason = "pending integer conventions")]
|
reason = "pending integer conventions",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn ldexp(x: f32, exp: isize) -> f32 {
|
pub fn ldexp(x: f32, exp: isize) -> f32 {
|
||||||
unsafe { cmath::ldexpf(x, exp as c_int) }
|
unsafe { cmath::ldexpf(x, exp as c_int) }
|
||||||
|
@ -668,7 +673,8 @@ impl f32 {
|
||||||
/// assert!(abs_difference_1 <= f32::EPSILON);
|
/// assert!(abs_difference_1 <= f32::EPSILON);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_extras",
|
#[unstable(feature = "float_extras",
|
||||||
reason = "pending integer conventions")]
|
reason = "pending integer conventions",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn frexp(self) -> (f32, isize) {
|
pub fn frexp(self) -> (f32, isize) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -693,7 +699,8 @@ impl f32 {
|
||||||
/// assert!(abs_diff <= f32::EPSILON);
|
/// assert!(abs_diff <= f32::EPSILON);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_extras",
|
#[unstable(feature = "float_extras",
|
||||||
reason = "unsure about its place in the world")]
|
reason = "unsure about its place in the world",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn next_after(self, other: f32) -> f32 {
|
pub fn next_after(self, other: f32) -> f32 {
|
||||||
unsafe { cmath::nextafterf(self, other) }
|
unsafe { cmath::nextafterf(self, other) }
|
||||||
|
|
|
@ -80,7 +80,8 @@ mod cmath {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl f64 {
|
impl f64 {
|
||||||
/// Parses a float as with a given radix
|
/// Parses a float as with a given radix
|
||||||
#[unstable(feature = "float_from_str_radix", reason = "recently moved API")]
|
#[unstable(feature = "float_from_str_radix", reason = "recently moved API",
|
||||||
|
issue = "27736")]
|
||||||
pub fn from_str_radix(s: &str, radix: u32) -> Result<f64, ParseFloatError> {
|
pub fn from_str_radix(s: &str, radix: u32) -> Result<f64, ParseFloatError> {
|
||||||
num::Float::from_str_radix(s, radix)
|
num::Float::from_str_radix(s, radix)
|
||||||
}
|
}
|
||||||
|
@ -205,7 +206,8 @@ impl f64 {
|
||||||
/// assert!(abs_difference < 1e-10);
|
/// assert!(abs_difference < 1e-10);
|
||||||
/// ```
|
/// ```
|
||||||
/// [floating-point]: ../../../../../reference.html#machine-types
|
/// [floating-point]: ../../../../../reference.html#machine-types
|
||||||
#[unstable(feature = "float_extras", reason = "signature is undecided")]
|
#[unstable(feature = "float_extras", reason = "signature is undecided",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
|
pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
|
||||||
|
|
||||||
|
@ -575,7 +577,8 @@ impl f64 {
|
||||||
/// assert!(abs_difference < 1e-10);
|
/// assert!(abs_difference < 1e-10);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_extras",
|
#[unstable(feature = "float_extras",
|
||||||
reason = "pending integer conventions")]
|
reason = "pending integer conventions",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn ldexp(x: f64, exp: isize) -> f64 {
|
pub fn ldexp(x: f64, exp: isize) -> f64 {
|
||||||
unsafe { cmath::ldexp(x, exp as c_int) }
|
unsafe { cmath::ldexp(x, exp as c_int) }
|
||||||
|
@ -601,7 +604,8 @@ impl f64 {
|
||||||
/// assert!(abs_difference_1 < 1e-10);
|
/// assert!(abs_difference_1 < 1e-10);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_extras",
|
#[unstable(feature = "float_extras",
|
||||||
reason = "pending integer conventions")]
|
reason = "pending integer conventions",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn frexp(self) -> (f64, isize) {
|
pub fn frexp(self) -> (f64, isize) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -624,7 +628,8 @@ impl f64 {
|
||||||
/// assert!(abs_diff < 1e-10);
|
/// assert!(abs_diff < 1e-10);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_extras",
|
#[unstable(feature = "float_extras",
|
||||||
reason = "unsure about its place in the world")]
|
reason = "unsure about its place in the world",
|
||||||
|
issue = "27752")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn next_after(self, other: f64) -> f64 {
|
pub fn next_after(self, other: f64) -> f64 {
|
||||||
unsafe { cmath::nextafter(self, other) }
|
unsafe { cmath::nextafter(self, other) }
|
||||||
|
|
|
@ -49,9 +49,11 @@
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[stable(feature = "raw_os", since = "1.1.0")]
|
#[stable(feature = "raw_os", since = "1.1.0")]
|
||||||
pub enum c_void {
|
pub enum c_void {
|
||||||
#[unstable(feature = "c_void_variant", reason = "should not have to exist")]
|
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
|
||||||
|
issue = "0")]
|
||||||
#[doc(hidden)] __variant1,
|
#[doc(hidden)] __variant1,
|
||||||
#[unstable(feature = "c_void_variant", reason = "should not have to exist")]
|
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
|
||||||
|
issue = "0")]
|
||||||
#[doc(hidden)] __variant2,
|
#[doc(hidden)] __variant2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -725,7 +725,7 @@ impl<'a> Components<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Examine the next component without consuming it.
|
/// Examine the next component without consuming it.
|
||||||
#[unstable(feature = "path_components_peek")]
|
#[unstable(feature = "path_components_peek", issue = "27727")]
|
||||||
pub fn peek(&self) -> Option<Component<'a>> {
|
pub fn peek(&self) -> Option<Component<'a>> {
|
||||||
self.clone().next()
|
self.clone().next()
|
||||||
}
|
}
|
||||||
|
@ -1358,7 +1358,9 @@ impl Path {
|
||||||
/// Prefixes are relevant only for Windows paths, and consist of volumes
|
/// Prefixes are relevant only for Windows paths, and consist of volumes
|
||||||
/// like `C:`, UNC prefixes like `\\server`, and others described in more
|
/// like `C:`, UNC prefixes like `\\server`, and others described in more
|
||||||
/// detail in `std::os::windows::PathExt`.
|
/// detail in `std::os::windows::PathExt`.
|
||||||
#[unstable(feature = "path_prefix", reason = "uncertain whether to expose this convenience")]
|
#[unstable(feature = "path_prefix",
|
||||||
|
reason = "uncertain whether to expose this convenience",
|
||||||
|
issue = "27722")]
|
||||||
pub fn prefix(&self) -> Option<Prefix> {
|
pub fn prefix(&self) -> Option<Prefix> {
|
||||||
self.components().prefix
|
self.components().prefix
|
||||||
}
|
}
|
||||||
|
@ -1441,7 +1443,8 @@ impl Path {
|
||||||
///
|
///
|
||||||
/// If `base` is not a prefix of `self` (i.e. `starts_with`
|
/// If `base` is not a prefix of `self` (i.e. `starts_with`
|
||||||
/// returns false), then `relative_from` returns `None`.
|
/// returns false), then `relative_from` returns `None`.
|
||||||
#[unstable(feature = "path_relative_from", reason = "see #23284")]
|
#[unstable(feature = "path_relative_from", reason = "see #23284",
|
||||||
|
issue = "23284")]
|
||||||
pub fn relative_from<'a, P: ?Sized + AsRef<Path>>(&'a self, base: &'a P) -> Option<&Path>
|
pub fn relative_from<'a, P: ?Sized + AsRef<Path>>(&'a self, base: &'a P) -> Option<&Path>
|
||||||
{
|
{
|
||||||
iter_after(self.components(), base.as_ref().components()).map(|c| c.as_path())
|
iter_after(self.components(), base.as_ref().components()).map(|c| c.as_path())
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
//! between the two sources. (Also note that, on some systems e.g. FreeBSD, both `/dev/random`
|
//! between the two sources. (Also note that, on some systems e.g. FreeBSD, both `/dev/random`
|
||||||
//! and `/dev/urandom` may block once if the CSPRNG has not seeded yet.)
|
//! and `/dev/urandom` may block once if the CSPRNG has not seeded yet.)
|
||||||
|
|
||||||
#![unstable(feature = "rand")]
|
#![unstable(feature = "rand", issue = "0")]
|
||||||
|
|
||||||
use cell::RefCell;
|
use cell::RefCell;
|
||||||
use io;
|
use io;
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
|
|
||||||
#![unstable(feature = "rt",
|
#![unstable(feature = "rt",
|
||||||
reason = "this public module should not exist and is highly likely \
|
reason = "this public module should not exist and is highly likely \
|
||||||
to disappear")]
|
to disappear",
|
||||||
|
issue = "0")]
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
|
@ -76,7 +76,8 @@ pub struct Condvar { inner: Box<StaticCondvar> }
|
||||||
/// static CVAR: StaticCondvar = CONDVAR_INIT;
|
/// static CVAR: StaticCondvar = CONDVAR_INIT;
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub struct StaticCondvar {
|
pub struct StaticCondvar {
|
||||||
inner: sys::Condvar,
|
inner: sys::Condvar,
|
||||||
mutex: AtomicUsize,
|
mutex: AtomicUsize,
|
||||||
|
@ -84,7 +85,8 @@ pub struct StaticCondvar {
|
||||||
|
|
||||||
/// Constant initializer for a statically allocated condition variable.
|
/// Constant initializer for a statically allocated condition variable.
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub const CONDVAR_INIT: StaticCondvar = StaticCondvar::new();
|
pub const CONDVAR_INIT: StaticCondvar = StaticCondvar::new();
|
||||||
|
|
||||||
impl Condvar {
|
impl Condvar {
|
||||||
|
@ -173,7 +175,8 @@ impl Condvar {
|
||||||
///
|
///
|
||||||
/// Like `wait`, the lock specified will be re-acquired when this function
|
/// Like `wait`, the lock specified will be re-acquired when this function
|
||||||
/// returns, regardless of whether the timeout elapsed or not.
|
/// returns, regardless of whether the timeout elapsed or not.
|
||||||
#[unstable(feature = "wait_timeout", reason = "waiting for Duration")]
|
#[unstable(feature = "wait_timeout", reason = "waiting for Duration",
|
||||||
|
issue = "27772")]
|
||||||
pub fn wait_timeout<'a, T>(&self, guard: MutexGuard<'a, T>,
|
pub fn wait_timeout<'a, T>(&self, guard: MutexGuard<'a, T>,
|
||||||
dur: Duration)
|
dur: Duration)
|
||||||
-> LockResult<(MutexGuard<'a, T>, bool)> {
|
-> LockResult<(MutexGuard<'a, T>, bool)> {
|
||||||
|
@ -190,7 +193,8 @@ impl Condvar {
|
||||||
/// that the implementation will repeatedly wait while the duration has not
|
/// that the implementation will repeatedly wait while the duration has not
|
||||||
/// passed and the provided function returns `false`.
|
/// passed and the provided function returns `false`.
|
||||||
#[unstable(feature = "wait_timeout_with",
|
#[unstable(feature = "wait_timeout_with",
|
||||||
reason = "unsure if this API is broadly needed or what form it should take")]
|
reason = "unsure if this API is broadly needed or what form it should take",
|
||||||
|
issue = "27748")]
|
||||||
pub fn wait_timeout_with<'a, T, F>(&self,
|
pub fn wait_timeout_with<'a, T, F>(&self,
|
||||||
guard: MutexGuard<'a, T>,
|
guard: MutexGuard<'a, T>,
|
||||||
dur: Duration,
|
dur: Duration,
|
||||||
|
@ -234,7 +238,8 @@ impl Drop for Condvar {
|
||||||
impl StaticCondvar {
|
impl StaticCondvar {
|
||||||
/// Creates a new condition variable
|
/// Creates a new condition variable
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub const fn new() -> StaticCondvar {
|
pub const fn new() -> StaticCondvar {
|
||||||
StaticCondvar {
|
StaticCondvar {
|
||||||
inner: sys::Condvar::new(),
|
inner: sys::Condvar::new(),
|
||||||
|
@ -247,7 +252,8 @@ impl StaticCondvar {
|
||||||
///
|
///
|
||||||
/// See `Condvar::wait`.
|
/// See `Condvar::wait`.
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub fn wait<'a, T>(&'static self, guard: MutexGuard<'a, T>)
|
pub fn wait<'a, T>(&'static self, guard: MutexGuard<'a, T>)
|
||||||
-> LockResult<MutexGuard<'a, T>> {
|
-> LockResult<MutexGuard<'a, T>> {
|
||||||
let poisoned = unsafe {
|
let poisoned = unsafe {
|
||||||
|
@ -268,7 +274,8 @@ impl StaticCondvar {
|
||||||
///
|
///
|
||||||
/// See `Condvar::wait_timeout`.
|
/// See `Condvar::wait_timeout`.
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub fn wait_timeout_ms<'a, T>(&'static self, guard: MutexGuard<'a, T>, ms: u32)
|
pub fn wait_timeout_ms<'a, T>(&'static self, guard: MutexGuard<'a, T>, ms: u32)
|
||||||
-> LockResult<(MutexGuard<'a, T>, bool)> {
|
-> LockResult<(MutexGuard<'a, T>, bool)> {
|
||||||
self.wait_timeout(guard, Duration::from_millis(ms as u64))
|
self.wait_timeout(guard, Duration::from_millis(ms as u64))
|
||||||
|
@ -279,7 +286,8 @@ impl StaticCondvar {
|
||||||
///
|
///
|
||||||
/// See `Condvar::wait_timeout`.
|
/// See `Condvar::wait_timeout`.
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub fn wait_timeout<'a, T>(&'static self,
|
pub fn wait_timeout<'a, T>(&'static self,
|
||||||
guard: MutexGuard<'a, T>,
|
guard: MutexGuard<'a, T>,
|
||||||
timeout: Duration)
|
timeout: Duration)
|
||||||
|
@ -305,7 +313,8 @@ impl StaticCondvar {
|
||||||
///
|
///
|
||||||
/// See `Condvar::wait_timeout_with`.
|
/// See `Condvar::wait_timeout_with`.
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub fn wait_timeout_with<'a, T, F>(&'static self,
|
pub fn wait_timeout_with<'a, T, F>(&'static self,
|
||||||
guard: MutexGuard<'a, T>,
|
guard: MutexGuard<'a, T>,
|
||||||
dur: Duration,
|
dur: Duration,
|
||||||
|
@ -351,14 +360,16 @@ impl StaticCondvar {
|
||||||
///
|
///
|
||||||
/// See `Condvar::notify_one`.
|
/// See `Condvar::notify_one`.
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub fn notify_one(&'static self) { unsafe { self.inner.notify_one() } }
|
pub fn notify_one(&'static self) { unsafe { self.inner.notify_one() } }
|
||||||
|
|
||||||
/// Wakes up all blocked threads on this condvar.
|
/// Wakes up all blocked threads on this condvar.
|
||||||
///
|
///
|
||||||
/// See `Condvar::notify_all`.
|
/// See `Condvar::notify_all`.
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub fn notify_all(&'static self) { unsafe { self.inner.notify_all() } }
|
pub fn notify_all(&'static self) { unsafe { self.inner.notify_all() } }
|
||||||
|
|
||||||
/// Deallocates all resources associated with this static condvar.
|
/// Deallocates all resources associated with this static condvar.
|
||||||
|
@ -368,7 +379,8 @@ impl StaticCondvar {
|
||||||
/// users of the condvar. This method is required to be called to not leak
|
/// users of the condvar. This method is required to be called to not leak
|
||||||
/// memory on all platforms.
|
/// memory on all platforms.
|
||||||
#[unstable(feature = "static_condvar",
|
#[unstable(feature = "static_condvar",
|
||||||
reason = "may be merged with Condvar in the future")]
|
reason = "may be merged with Condvar in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub unsafe fn destroy(&'static self) {
|
pub unsafe fn destroy(&'static self) {
|
||||||
self.inner.destroy()
|
self.inner.destroy()
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
module will likely be replaced, and it is currently \
|
module will likely be replaced, and it is currently \
|
||||||
unknown how much API breakage that will cause. The ability \
|
unknown how much API breakage that will cause. The ability \
|
||||||
to select over a number of channels will remain forever, \
|
to select over a number of channels will remain forever, \
|
||||||
but no guarantees beyond this are being made")]
|
but no guarantees beyond this are being made",
|
||||||
|
issue = "27800")]
|
||||||
|
|
||||||
|
|
||||||
use core::cell::{Cell, UnsafeCell};
|
use core::cell::{Cell, UnsafeCell};
|
||||||
|
|
|
@ -151,7 +151,8 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
|
||||||
/// // lock is unlocked here.
|
/// // lock is unlocked here.
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "static_mutex",
|
#[unstable(feature = "static_mutex",
|
||||||
reason = "may be merged with Mutex in the future")]
|
reason = "may be merged with Mutex in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub struct StaticMutex {
|
pub struct StaticMutex {
|
||||||
lock: sys::Mutex,
|
lock: sys::Mutex,
|
||||||
poison: poison::Flag,
|
poison: poison::Flag,
|
||||||
|
@ -177,7 +178,8 @@ impl<'a, T: ?Sized> !marker::Send for MutexGuard<'a, T> {}
|
||||||
/// Static initialization of a mutex. This constant can be used to initialize
|
/// Static initialization of a mutex. This constant can be used to initialize
|
||||||
/// other mutex constants.
|
/// other mutex constants.
|
||||||
#[unstable(feature = "static_mutex",
|
#[unstable(feature = "static_mutex",
|
||||||
reason = "may be merged with Mutex in the future")]
|
reason = "may be merged with Mutex in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub const MUTEX_INIT: StaticMutex = StaticMutex::new();
|
pub const MUTEX_INIT: StaticMutex = StaticMutex::new();
|
||||||
|
|
||||||
impl<T> Mutex<T> {
|
impl<T> Mutex<T> {
|
||||||
|
@ -271,7 +273,8 @@ unsafe impl Sync for Dummy {}
|
||||||
static DUMMY: Dummy = Dummy(UnsafeCell::new(()));
|
static DUMMY: Dummy = Dummy(UnsafeCell::new(()));
|
||||||
|
|
||||||
#[unstable(feature = "static_mutex",
|
#[unstable(feature = "static_mutex",
|
||||||
reason = "may be merged with Mutex in the future")]
|
reason = "may be merged with Mutex in the future",
|
||||||
|
issue = "27717")]
|
||||||
impl StaticMutex {
|
impl StaticMutex {
|
||||||
/// Creates a new mutex in an unlocked state ready for use.
|
/// Creates a new mutex in an unlocked state ready for use.
|
||||||
pub const fn new() -> StaticMutex {
|
pub const fn new() -> StaticMutex {
|
||||||
|
|
|
@ -98,7 +98,8 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
|
||||||
/// unsafe { LOCK.destroy() } // free all resources
|
/// unsafe { LOCK.destroy() } // free all resources
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "static_rwlock",
|
#[unstable(feature = "static_rwlock",
|
||||||
reason = "may be merged with RwLock in the future")]
|
reason = "may be merged with RwLock in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub struct StaticRwLock {
|
pub struct StaticRwLock {
|
||||||
lock: sys::RWLock,
|
lock: sys::RWLock,
|
||||||
poison: poison::Flag,
|
poison: poison::Flag,
|
||||||
|
@ -106,7 +107,8 @@ pub struct StaticRwLock {
|
||||||
|
|
||||||
/// Constant initialization for a statically-initialized rwlock.
|
/// Constant initialization for a statically-initialized rwlock.
|
||||||
#[unstable(feature = "static_rwlock",
|
#[unstable(feature = "static_rwlock",
|
||||||
reason = "may be merged with RwLock in the future")]
|
reason = "may be merged with RwLock in the future",
|
||||||
|
issue = "27717")]
|
||||||
pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock::new();
|
pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock::new();
|
||||||
|
|
||||||
/// RAII structure used to release the shared read access of a lock when
|
/// RAII structure used to release the shared read access of a lock when
|
||||||
|
@ -285,7 +287,8 @@ unsafe impl Sync for Dummy {}
|
||||||
static DUMMY: Dummy = Dummy(UnsafeCell::new(()));
|
static DUMMY: Dummy = Dummy(UnsafeCell::new(()));
|
||||||
|
|
||||||
#[unstable(feature = "static_rwlock",
|
#[unstable(feature = "static_rwlock",
|
||||||
reason = "may be merged with RwLock in the future")]
|
reason = "may be merged with RwLock in the future",
|
||||||
|
issue = "27717")]
|
||||||
impl StaticRwLock {
|
impl StaticRwLock {
|
||||||
/// Creates a new rwlock.
|
/// Creates a new rwlock.
|
||||||
pub const fn new() -> StaticRwLock {
|
pub const fn new() -> StaticRwLock {
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
|
|
||||||
#![unstable(feature = "semaphore",
|
#![unstable(feature = "semaphore",
|
||||||
reason = "the interaction between semaphores and the acquisition/release \
|
reason = "the interaction between semaphores and the acquisition/release \
|
||||||
of resources is currently unclear")]
|
of resources is currently unclear",
|
||||||
|
issue = "27798")]
|
||||||
|
|
||||||
use ops::Drop;
|
use ops::Drop;
|
||||||
use sync::{Mutex, Condvar};
|
use sync::{Mutex, Condvar};
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
#![unstable(feature = "reentrant_mutex", reason = "new API")]
|
|
||||||
|
#![unstable(feature = "reentrant_mutex", reason = "new API",
|
||||||
|
issue = "27738")]
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
#![unstable(feature = "thread_local_internals")]
|
#![unstable(feature = "thread_local_internals", issue = "0")]
|
||||||
#![allow(dead_code)] // sys isn't exported yet
|
#![allow(dead_code)] // sys isn't exported yet
|
||||||
|
|
||||||
use sync::atomic::{self, AtomicUsize, Ordering};
|
use sync::atomic::{self, AtomicUsize, Ordering};
|
||||||
|
|
|
@ -22,43 +22,43 @@ use sys::fs::MetadataExt as UnixMetadataExt;
|
||||||
use sys;
|
use sys;
|
||||||
use sys_common::{FromInner, AsInner, AsInnerMut};
|
use sys_common::{FromInner, AsInner, AsInnerMut};
|
||||||
|
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const USER_READ: raw::mode_t = 0o400;
|
pub const USER_READ: raw::mode_t = 0o400;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const USER_WRITE: raw::mode_t = 0o200;
|
pub const USER_WRITE: raw::mode_t = 0o200;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const USER_EXECUTE: raw::mode_t = 0o100;
|
pub const USER_EXECUTE: raw::mode_t = 0o100;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const USER_RWX: raw::mode_t = 0o700;
|
pub const USER_RWX: raw::mode_t = 0o700;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const GROUP_READ: raw::mode_t = 0o040;
|
pub const GROUP_READ: raw::mode_t = 0o040;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const GROUP_WRITE: raw::mode_t = 0o020;
|
pub const GROUP_WRITE: raw::mode_t = 0o020;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const GROUP_EXECUTE: raw::mode_t = 0o010;
|
pub const GROUP_EXECUTE: raw::mode_t = 0o010;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const GROUP_RWX: raw::mode_t = 0o070;
|
pub const GROUP_RWX: raw::mode_t = 0o070;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const OTHER_READ: raw::mode_t = 0o004;
|
pub const OTHER_READ: raw::mode_t = 0o004;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const OTHER_WRITE: raw::mode_t = 0o002;
|
pub const OTHER_WRITE: raw::mode_t = 0o002;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const OTHER_EXECUTE: raw::mode_t = 0o001;
|
pub const OTHER_EXECUTE: raw::mode_t = 0o001;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const OTHER_RWX: raw::mode_t = 0o007;
|
pub const OTHER_RWX: raw::mode_t = 0o007;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const ALL_READ: raw::mode_t = 0o444;
|
pub const ALL_READ: raw::mode_t = 0o444;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const ALL_WRITE: raw::mode_t = 0o222;
|
pub const ALL_WRITE: raw::mode_t = 0o222;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const ALL_EXECUTE: raw::mode_t = 0o111;
|
pub const ALL_EXECUTE: raw::mode_t = 0o111;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const ALL_RWX: raw::mode_t = 0o777;
|
pub const ALL_RWX: raw::mode_t = 0o777;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const SETUID: raw::mode_t = 0o4000;
|
pub const SETUID: raw::mode_t = 0o4000;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const SETGID: raw::mode_t = 0o2000;
|
pub const SETGID: raw::mode_t = 0o2000;
|
||||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||||
pub const STICKY_BIT: raw::mode_t = 0o1000;
|
pub const STICKY_BIT: raw::mode_t = 0o1000;
|
||||||
|
|
||||||
/// Unix-specific extensions to `Permissions`
|
/// Unix-specific extensions to `Permissions`
|
||||||
|
@ -178,7 +178,8 @@ impl MetadataExt for fs::Metadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add special unix types (block/char device, fifo and socket)
|
/// Add special unix types (block/char device, fifo and socket)
|
||||||
#[unstable(feature = "file_type_ext", reason = "recently added API")]
|
#[unstable(feature = "file_type_ext", reason = "recently added API",
|
||||||
|
issue = "27796")]
|
||||||
pub trait FileTypeExt {
|
pub trait FileTypeExt {
|
||||||
/// Returns whether this file type is a block device.
|
/// Returns whether this file type is a block device.
|
||||||
fn is_block_device(&self) -> bool;
|
fn is_block_device(&self) -> bool;
|
||||||
|
@ -190,7 +191,8 @@ pub trait FileTypeExt {
|
||||||
fn is_socket(&self) -> bool;
|
fn is_socket(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "file_type_ext", reason = "recently added API")]
|
#[unstable(feature = "file_type_ext", reason = "recently added API",
|
||||||
|
issue = "27796")]
|
||||||
impl FileTypeExt for fs::FileType {
|
impl FileTypeExt for fs::FileType {
|
||||||
fn is_block_device(&self) -> bool { self.as_inner().is(libc::S_IFBLK) }
|
fn is_block_device(&self) -> bool { self.as_inner().is(libc::S_IFBLK) }
|
||||||
fn is_char_device(&self) -> bool { self.as_inner().is(libc::S_IFCHR) }
|
fn is_char_device(&self) -> bool { self.as_inner().is(libc::S_IFCHR) }
|
||||||
|
@ -240,7 +242,8 @@ pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()>
|
||||||
sys::fs::symlink(src.as_ref(), dst.as_ref())
|
sys::fs::symlink(src.as_ref(), dst.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "dir_builder", reason = "recently added API")]
|
#[unstable(feature = "dir_builder", reason = "recently added API",
|
||||||
|
issue = "27710")]
|
||||||
/// An extension trait for `fs::DirBuilder` for unix-specific options.
|
/// An extension trait for `fs::DirBuilder` for unix-specific options.
|
||||||
pub trait DirBuilderExt {
|
pub trait DirBuilderExt {
|
||||||
/// Sets the mode to create new directories with. This option defaults to
|
/// Sets the mode to create new directories with. This option defaults to
|
||||||
|
|
|
@ -61,7 +61,8 @@ pub trait FromRawFd {
|
||||||
|
|
||||||
/// A trait to express the ability to consume an object and acquire ownership of
|
/// A trait to express the ability to consume an object and acquire ownership of
|
||||||
/// its raw file descriptor.
|
/// its raw file descriptor.
|
||||||
#[unstable(feature = "into_raw_os", reason = "recently added API")]
|
#[unstable(feature = "into_raw_os", reason = "recently added API",
|
||||||
|
issue = "27797")]
|
||||||
pub trait IntoRawFd {
|
pub trait IntoRawFd {
|
||||||
/// Consumes this object, returning the raw underlying file descriptor.
|
/// Consumes this object, returning the raw underlying file descriptor.
|
||||||
///
|
///
|
||||||
|
|
|
@ -32,15 +32,17 @@ pub trait CommandExt {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn gid(&mut self, id: gid_t) -> &mut process::Command;
|
fn gid(&mut self, id: gid_t) -> &mut process::Command;
|
||||||
|
|
||||||
/// Create a new session (cf. `setsid(2)`) for the child process. This means that the child is
|
/// Create a new session (cf. `setsid(2)`) for the child process. This means
|
||||||
/// the leader of a new process group. The parent process remains the child reaper of the new
|
/// that the child is the leader of a new process group. The parent process
|
||||||
/// process.
|
/// remains the child reaper of the new process.
|
||||||
///
|
///
|
||||||
/// This is not enough to create a daemon process. The *init* process should be the child
|
/// This is not enough to create a daemon process. The *init* process should
|
||||||
/// reaper of a daemon. This can be achieved if the parent process exit. Moreover, a daemon
|
/// be the child reaper of a daemon. This can be achieved if the parent
|
||||||
/// should not have a controlling terminal. To acheive this, a session leader (the child) must
|
/// process exit. Moreover, a daemon should not have a controlling terminal.
|
||||||
/// spawn another process (the daemon) in the same session.
|
/// To acheive this, a session leader (the child) must spawn another process
|
||||||
#[unstable(feature = "process_session_leader", reason = "recently added")]
|
/// (the daemon) in the same session.
|
||||||
|
#[unstable(feature = "process_session_leader", reason = "recently added",
|
||||||
|
issue = "27811")]
|
||||||
fn session_leader(&mut self, on: bool) -> &mut process::Command;
|
fn session_leader(&mut self, on: bool) -> &mut process::Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@ pub trait FromRawHandle {
|
||||||
|
|
||||||
/// A trait to express the ability to consume an object and acquire ownership of
|
/// A trait to express the ability to consume an object and acquire ownership of
|
||||||
/// its raw `HANDLE`.
|
/// its raw `HANDLE`.
|
||||||
#[unstable(feature = "into_raw_os", reason = "recently added API")]
|
#[unstable(feature = "into_raw_os", reason = "recently added API",
|
||||||
|
issue = "27797")]
|
||||||
pub trait IntoRawHandle {
|
pub trait IntoRawHandle {
|
||||||
/// Consumes this object, returning the raw underlying handle.
|
/// Consumes this object, returning the raw underlying handle.
|
||||||
///
|
///
|
||||||
|
@ -110,7 +111,8 @@ pub trait FromRawSocket {
|
||||||
|
|
||||||
/// A trait to express the ability to consume an object and acquire ownership of
|
/// A trait to express the ability to consume an object and acquire ownership of
|
||||||
/// its raw `SOCKET`.
|
/// its raw `SOCKET`.
|
||||||
#[unstable(feature = "into_raw_os", reason = "recently added API")]
|
#[unstable(feature = "into_raw_os", reason = "recently added API",
|
||||||
|
issue = "27797")]
|
||||||
pub trait IntoRawSocket {
|
pub trait IntoRawSocket {
|
||||||
/// Consumes this object, returning the raw underlying socket.
|
/// Consumes this object, returning the raw underlying socket.
|
||||||
///
|
///
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
//! Thread local storage
|
//! Thread local storage
|
||||||
|
|
||||||
#![unstable(feature = "thread_local_internals")]
|
#![unstable(feature = "thread_local_internals", issue = "0")]
|
||||||
|
|
||||||
use cell::UnsafeCell;
|
use cell::UnsafeCell;
|
||||||
|
|
||||||
|
@ -137,7 +137,8 @@ macro_rules! thread_local {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[unstable(feature = "thread_local_internals",
|
#[unstable(feature = "thread_local_internals",
|
||||||
reason = "should not be necessary")]
|
reason = "should not be necessary",
|
||||||
|
issue = "0")]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[allow_internal_unstable]
|
#[allow_internal_unstable]
|
||||||
macro_rules! __thread_local_inner {
|
macro_rules! __thread_local_inner {
|
||||||
|
@ -153,7 +154,8 @@ macro_rules! __thread_local_inner {
|
||||||
|
|
||||||
/// Indicator of the state of a thread local storage key.
|
/// Indicator of the state of a thread local storage key.
|
||||||
#[unstable(feature = "thread_local_state",
|
#[unstable(feature = "thread_local_state",
|
||||||
reason = "state querying was recently added")]
|
reason = "state querying was recently added",
|
||||||
|
issue = "27716")]
|
||||||
#[derive(Eq, PartialEq, Copy, Clone)]
|
#[derive(Eq, PartialEq, Copy, Clone)]
|
||||||
pub enum LocalKeyState {
|
pub enum LocalKeyState {
|
||||||
/// All keys are in this state whenever a thread starts. Keys will
|
/// All keys are in this state whenever a thread starts. Keys will
|
||||||
|
@ -185,7 +187,8 @@ pub enum LocalKeyState {
|
||||||
impl<T: 'static> LocalKey<T> {
|
impl<T: 'static> LocalKey<T> {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[unstable(feature = "thread_local_internals",
|
#[unstable(feature = "thread_local_internals",
|
||||||
reason = "recently added to create a key")]
|
reason = "recently added to create a key",
|
||||||
|
issue = "0")]
|
||||||
pub const fn new(inner: fn() -> &'static __KeyInner<T>,
|
pub const fn new(inner: fn() -> &'static __KeyInner<T>,
|
||||||
init: fn() -> T) -> LocalKey<T> {
|
init: fn() -> T) -> LocalKey<T> {
|
||||||
LocalKey {
|
LocalKey {
|
||||||
|
@ -248,7 +251,8 @@ impl<T: 'static> LocalKey<T> {
|
||||||
/// to be able to be accessed. Keys in the `Destroyed` state will panic on
|
/// to be able to be accessed. Keys in the `Destroyed` state will panic on
|
||||||
/// any call to `with`.
|
/// any call to `with`.
|
||||||
#[unstable(feature = "thread_local_state",
|
#[unstable(feature = "thread_local_state",
|
||||||
reason = "state querying was recently added")]
|
reason = "state querying was recently added",
|
||||||
|
issue = "27716")]
|
||||||
pub fn state(&'static self) -> LocalKeyState {
|
pub fn state(&'static self) -> LocalKeyState {
|
||||||
unsafe {
|
unsafe {
|
||||||
match (self.inner)().get() {
|
match (self.inner)().get() {
|
||||||
|
|
|
@ -167,7 +167,6 @@ use any::Any;
|
||||||
use cell::UnsafeCell;
|
use cell::UnsafeCell;
|
||||||
use fmt;
|
use fmt;
|
||||||
use io;
|
use io;
|
||||||
use marker::PhantomData;
|
|
||||||
use rt::{self, unwind};
|
use rt::{self, unwind};
|
||||||
use sync::{Mutex, Condvar, Arc};
|
use sync::{Mutex, Condvar, Arc};
|
||||||
use sys::thread as imp;
|
use sys::thread as imp;
|
||||||
|
@ -185,8 +184,9 @@ use time::Duration;
|
||||||
pub use self::local::{LocalKey, LocalKeyState};
|
pub use self::local::{LocalKey, LocalKeyState};
|
||||||
|
|
||||||
#[unstable(feature = "scoped_tls",
|
#[unstable(feature = "scoped_tls",
|
||||||
reason = "scoped TLS has yet to have wide enough use to fully \
|
reason = "scoped TLS has yet to have wide enough use to fully \
|
||||||
consider stabilizing its interface")]
|
consider stabilizing its interface",
|
||||||
|
issue = "27715")]
|
||||||
pub use self::scoped_tls::ScopedKey;
|
pub use self::scoped_tls::ScopedKey;
|
||||||
|
|
||||||
#[doc(hidden)] pub use self::local::__KeyInner as __LocalKeyInner;
|
#[doc(hidden)] pub use self::local::__KeyInner as __LocalKeyInner;
|
||||||
|
@ -375,7 +375,8 @@ pub fn panicking() -> bool {
|
||||||
/// });
|
/// });
|
||||||
/// assert!(result.is_err());
|
/// assert!(result.is_err());
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "catch_panic", reason = "recent API addition")]
|
#[unstable(feature = "catch_panic", reason = "recent API addition",
|
||||||
|
issue = "27719")]
|
||||||
pub fn catch_panic<F, R>(f: F) -> Result<R>
|
pub fn catch_panic<F, R>(f: F) -> Result<R>
|
||||||
where F: FnOnce() -> R + Send + 'static
|
where F: FnOnce() -> R + Send + 'static
|
||||||
{
|
{
|
||||||
|
@ -409,7 +410,8 @@ pub fn sleep_ms(ms: u32) {
|
||||||
/// signal being received or a spurious wakeup. Platforms which do not support
|
/// signal being received or a spurious wakeup. Platforms which do not support
|
||||||
/// nanosecond precision for sleeping will have `dur` rounded up to the nearest
|
/// nanosecond precision for sleeping will have `dur` rounded up to the nearest
|
||||||
/// granularity of time they can sleep for.
|
/// granularity of time they can sleep for.
|
||||||
#[unstable(feature = "thread_sleep", reason = "waiting on Duration")]
|
#[unstable(feature = "thread_sleep", reason = "waiting on Duration",
|
||||||
|
issue = "27771")]
|
||||||
pub fn sleep(dur: Duration) {
|
pub fn sleep(dur: Duration) {
|
||||||
imp::Thread::sleep(dur)
|
imp::Thread::sleep(dur)
|
||||||
}
|
}
|
||||||
|
@ -479,7 +481,8 @@ pub fn park_timeout_ms(ms: u32) {
|
||||||
///
|
///
|
||||||
/// Platforms which do not support nanosecond precision for sleeping will have
|
/// Platforms which do not support nanosecond precision for sleeping will have
|
||||||
/// `dur` rounded up to the nearest granularity of time they can sleep for.
|
/// `dur` rounded up to the nearest granularity of time they can sleep for.
|
||||||
#[unstable(feature = "park_timeout", reason = "waiting on Duration")]
|
#[unstable(feature = "park_timeout", reason = "waiting on Duration",
|
||||||
|
issue = "27771")]
|
||||||
pub fn park_timeout(dur: Duration) {
|
pub fn park_timeout(dur: Duration) {
|
||||||
let thread = current();
|
let thread = current();
|
||||||
let mut guard = thread.inner.lock.lock().unwrap();
|
let mut guard = thread.inner.lock.lock().unwrap();
|
||||||
|
@ -552,7 +555,7 @@ impl thread_info::NewThread for Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// JoinHandle and JoinGuard
|
// JoinHandle
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// Indicates the manner in which a thread exited.
|
/// Indicates the manner in which a thread exited.
|
||||||
|
@ -578,7 +581,7 @@ struct Packet<T>(Arc<UnsafeCell<Option<Result<T>>>>);
|
||||||
unsafe impl<T: Send> Send for Packet<T> {}
|
unsafe impl<T: Send> Send for Packet<T> {}
|
||||||
unsafe impl<T: Sync> Sync for Packet<T> {}
|
unsafe impl<T: Sync> Sync for Packet<T> {}
|
||||||
|
|
||||||
/// Inner representation for JoinHandle and JoinGuard
|
/// Inner representation for JoinHandle
|
||||||
struct JoinInner<T> {
|
struct JoinInner<T> {
|
||||||
native: Option<imp::Thread>,
|
native: Option<imp::Thread>,
|
||||||
thread: Thread,
|
thread: Thread,
|
||||||
|
@ -596,8 +599,7 @@ impl<T> JoinInner<T> {
|
||||||
|
|
||||||
/// An owned permission to join on a thread (block on its termination).
|
/// An owned permission to join on a thread (block on its termination).
|
||||||
///
|
///
|
||||||
/// Unlike a `JoinGuard`, a `JoinHandle` *detaches* the child thread
|
/// A `JoinHandle` *detaches* the child thread when it is dropped.
|
||||||
/// when it is dropped, rather than automatically joining on drop.
|
|
||||||
///
|
///
|
||||||
/// Due to platform restrictions, it is not possible to `Clone` this
|
/// Due to platform restrictions, it is not possible to `Clone` this
|
||||||
/// handle: the ability to join a child thread is a uniquely-owned
|
/// handle: the ability to join a child thread is a uniquely-owned
|
||||||
|
@ -622,63 +624,9 @@ impl<T> JoinHandle<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An RAII-style guard that will block until thread termination when dropped.
|
|
||||||
///
|
|
||||||
/// The type `T` is the return type for the thread's main function.
|
|
||||||
///
|
|
||||||
/// Joining on drop is necessary to ensure memory safety when stack
|
|
||||||
/// data is shared between a parent and child thread.
|
|
||||||
///
|
|
||||||
/// Due to platform restrictions, it is not possible to `Clone` this
|
|
||||||
/// handle: the ability to join a child thread is a uniquely-owned
|
|
||||||
/// permission.
|
|
||||||
#[must_use = "thread will be immediately joined if `JoinGuard` is not used"]
|
|
||||||
#[unstable(feature = "scoped",
|
|
||||||
reason = "memory unsafe if destructor is avoided, see #24292")]
|
|
||||||
pub struct JoinGuard<'a, T: Send + 'a> {
|
|
||||||
inner: JoinInner<T>,
|
|
||||||
_marker: PhantomData<&'a T>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
unsafe impl<'a, T: Send + 'a> Sync for JoinGuard<'a, T> {}
|
|
||||||
|
|
||||||
impl<'a, T: Send + 'a> JoinGuard<'a, T> {
|
|
||||||
/// Extracts a handle to the thread this guard will join on.
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
pub fn thread(&self) -> &Thread {
|
|
||||||
&self.inner.thread
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Waits for the associated thread to finish, returning the result of the
|
|
||||||
/// thread's calculation.
|
|
||||||
///
|
|
||||||
/// # Panics
|
|
||||||
///
|
|
||||||
/// Panics on the child thread are propagated by panicking the parent.
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
pub fn join(mut self) -> T {
|
|
||||||
match self.inner.join() {
|
|
||||||
Ok(res) => res,
|
|
||||||
Err(_) => panic!("child thread {:?} panicked", self.thread()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unstable(feature = "scoped",
|
|
||||||
reason = "memory unsafe if destructor is avoided, see #24292")]
|
|
||||||
impl<'a, T: Send + 'a> Drop for JoinGuard<'a, T> {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
if self.inner.native.is_some() && self.inner.join().is_err() {
|
|
||||||
panic!("child thread {:?} panicked", self.thread());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn _assert_sync_and_send() {
|
fn _assert_sync_and_send() {
|
||||||
fn _assert_both<T: Send + Sync>() {}
|
fn _assert_both<T: Send + Sync>() {}
|
||||||
_assert_both::<JoinHandle<()>>();
|
_assert_both::<JoinHandle<()>>();
|
||||||
_assert_both::<JoinGuard<()>>();
|
|
||||||
_assert_both::<Thread>();
|
_assert_both::<Thread>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
//! });
|
//! });
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![unstable(feature = "thread_local_internals")]
|
#![unstable(feature = "thread_local_internals", issue = "0")]
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use self::imp::KeyInner as __KeyInner;
|
pub use self::imp::KeyInner as __KeyInner;
|
||||||
|
@ -54,7 +54,8 @@ pub use self::imp::KeyInner as __KeyInner;
|
||||||
/// their contents.
|
/// their contents.
|
||||||
#[unstable(feature = "scoped_tls",
|
#[unstable(feature = "scoped_tls",
|
||||||
reason = "scoped TLS has yet to have wide enough use to fully consider \
|
reason = "scoped TLS has yet to have wide enough use to fully consider \
|
||||||
stabilizing its interface")]
|
stabilizing its interface",
|
||||||
|
issue = "27715")]
|
||||||
pub struct ScopedKey<T:'static> { inner: fn() -> &'static imp::KeyInner<T> }
|
pub struct ScopedKey<T:'static> { inner: fn() -> &'static imp::KeyInner<T> }
|
||||||
|
|
||||||
/// Declare a new scoped thread local storage key.
|
/// Declare a new scoped thread local storage key.
|
||||||
|
@ -116,7 +117,8 @@ macro_rules! __scoped_thread_local_inner {
|
||||||
|
|
||||||
#[unstable(feature = "scoped_tls",
|
#[unstable(feature = "scoped_tls",
|
||||||
reason = "scoped TLS has yet to have wide enough use to fully consider \
|
reason = "scoped TLS has yet to have wide enough use to fully consider \
|
||||||
stabilizing its interface")]
|
stabilizing its interface",
|
||||||
|
issue = "27715")]
|
||||||
impl<T> ScopedKey<T> {
|
impl<T> ScopedKey<T> {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub const fn new(inner: fn() -> &'static imp::KeyInner<T>) -> ScopedKey<T> {
|
pub const fn new(inner: fn() -> &'static imp::KeyInner<T>) -> ScopedKey<T> {
|
||||||
|
|
|
@ -64,7 +64,8 @@ impl Duration {
|
||||||
#[unstable(feature = "duration_span",
|
#[unstable(feature = "duration_span",
|
||||||
reason = "unsure if this is the right API or whether it should \
|
reason = "unsure if this is the right API or whether it should \
|
||||||
wait for a more general \"moment in time\" \
|
wait for a more general \"moment in time\" \
|
||||||
abstraction")]
|
abstraction",
|
||||||
|
issue = "27799")]
|
||||||
pub fn span<F>(f: F) -> Duration where F: FnOnce() {
|
pub fn span<F>(f: F) -> Duration where F: FnOnce() {
|
||||||
let start = SteadyTime::now();
|
let start = SteadyTime::now();
|
||||||
f();
|
f();
|
||||||
|
|
Loading…
Reference in New Issue