1
Fork 0

rollup merge of #24377: apasel422/docs

Conflicts:
	src/libstd/net/ip.rs
	src/libstd/sys/unix/fs.rs
	src/libstd/sys/unix/mod.rs
	src/libstd/sys/windows/mod.rs
This commit is contained in:
Alex Crichton 2015-04-14 10:56:57 -07:00
commit ae7959d298
63 changed files with 377 additions and 377 deletions

View file

@ -923,7 +923,7 @@ impl BitVec {
self.set(insert_pos, elem); self.set(insert_pos, elem);
} }
/// Return the total number of bits in this vector /// Returns the total number of bits in this vector
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize { self.nbits } pub fn len(&self) -> usize { self.nbits }
@ -1695,7 +1695,7 @@ impl BitSet {
self.other_op(other, |w1, w2| w1 ^ w2); self.other_op(other, |w1, w2| w1 ^ w2);
} }
/// Return the number of set bits in this set. /// Returns the number of set bits in this set.
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize { pub fn len(&self) -> usize {

View file

@ -1339,7 +1339,7 @@ impl<K, V> BTreeMap<K, V> {
Values { inner: self.iter().map(second) } Values { inner: self.iter().map(second) }
} }
/// Return the number of elements in the map. /// Returns the number of elements in the map.
/// ///
/// # Examples /// # Examples
/// ///
@ -1354,7 +1354,7 @@ impl<K, V> BTreeMap<K, V> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize { self.length } pub fn len(&self) -> usize { self.length }
/// Return true if the map contains no elements. /// Returns true if the map contains no elements.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -284,7 +284,7 @@ impl<T: Ord> BTreeSet<T> {
Union{a: self.iter().peekable(), b: other.iter().peekable()} Union{a: self.iter().peekable(), b: other.iter().peekable()}
} }
/// Return the number of elements in the set /// Returns the number of elements in the set.
/// ///
/// # Examples /// # Examples
/// ///
@ -299,7 +299,7 @@ impl<T: Ord> BTreeSet<T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize { self.map.len() } pub fn len(&self) -> usize { self.map.len() }
/// Returns true if the set contains no elements /// Returns true if the set contains no elements.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -549,7 +549,7 @@ impl<T> [T] {
core_slice::SliceExt::binary_search_by(self, f) core_slice::SliceExt::binary_search_by(self, f)
} }
/// Return the number of elements in the slice /// Returns the number of elements in the slice.
/// ///
/// # Example /// # Example
/// ///
@ -757,7 +757,7 @@ impl<T> [T] {
core_slice::SliceExt::get_unchecked_mut(self, index) core_slice::SliceExt::get_unchecked_mut(self, index)
} }
/// Return an unsafe mutable pointer to the slice's buffer. /// Returns an unsafe mutable pointer to the slice's buffer.
/// ///
/// The caller must ensure that the slice outlives the pointer this /// The caller must ensure that the slice outlives the pointer this
/// function returns, or else it will end up pointing to garbage. /// function returns, or else it will end up pointing to garbage.
@ -984,7 +984,7 @@ impl<T> [T] {
core_slice::SliceExt::ends_with(self, needle) core_slice::SliceExt::ends_with(self, needle)
} }
/// Convert `self` into a vector without clones or allocation. /// Converts `self` into a vector without clones or allocation.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn into_vec(self: Box<Self>) -> Vec<T> { pub fn into_vec(self: Box<Self>) -> Vec<T> {

View file

@ -1248,7 +1248,7 @@ impl str {
core_str::StrExt::trim_right_matches(&self[..], pat) core_str::StrExt::trim_right_matches(&self[..], pat)
} }
/// Check that `index`-th byte lies at the start and/or end of a /// Checks that `index`-th byte lies at the start and/or end of a
/// UTF-8 code point sequence. /// UTF-8 code point sequence.
/// ///
/// The start and end of the string (when `index == self.len()`) are /// The start and end of the string (when `index == self.len()`) are
@ -1435,7 +1435,7 @@ impl str {
core_str::StrExt::char_at_reverse(&self[..], i) core_str::StrExt::char_at_reverse(&self[..], i)
} }
/// Convert `self` to a byte slice. /// Converts `self` to a byte slice.
/// ///
/// # Examples /// # Examples
/// ///
@ -1591,7 +1591,7 @@ impl str {
core_str::StrExt::subslice_offset(&self[..], inner) core_str::StrExt::subslice_offset(&self[..], inner)
} }
/// Return an unsafe pointer to the `&str`'s buffer. /// Returns an unsafe pointer to the `&str`'s buffer.
/// ///
/// The caller must ensure that the string outlives this pointer, and /// The caller must ensure that the string outlives this pointer, and
/// that it is not /// that it is not
@ -1609,7 +1609,7 @@ impl str {
core_str::StrExt::as_ptr(&self[..]) core_str::StrExt::as_ptr(&self[..])
} }
/// Return an iterator of `u16` over the string encoded as UTF-16. /// Returns an iterator of `u16` over the string encoded as UTF-16.
#[unstable(feature = "collections", #[unstable(feature = "collections",
reason = "this functionality may only be provided by libunicode")] reason = "this functionality may only be provided by libunicode")]
pub fn utf16_units(&self) -> Utf16Units { pub fn utf16_units(&self) -> Utf16Units {

View file

@ -343,7 +343,7 @@ impl String {
String { vec: bytes } String { vec: bytes }
} }
/// Return the underlying byte buffer, encoded as UTF-8. /// Returns the underlying byte buffer, encoded as UTF-8.
/// ///
/// # Examples /// # Examples
/// ///
@ -359,7 +359,7 @@ impl String {
self.vec self.vec
} }
/// Extract a string slice containing the entire string. /// Extracts a string slice containing the entire string.
#[inline] #[inline]
#[unstable(feature = "convert", #[unstable(feature = "convert",
reason = "waiting on RFC revision")] reason = "waiting on RFC revision")]
@ -603,7 +603,7 @@ impl String {
ch ch
} }
/// Insert a character into the string buffer at byte position `idx`. /// Inserts a character into the string buffer at byte position `idx`.
/// ///
/// # Warning /// # Warning
/// ///
@ -658,7 +658,7 @@ impl String {
&mut self.vec &mut self.vec
} }
/// Return the number of bytes in this string. /// Returns the number of bytes in this string.
/// ///
/// # Examples /// # Examples
/// ///
@ -701,12 +701,12 @@ impl String {
} }
impl FromUtf8Error { impl FromUtf8Error {
/// Consume this error, returning the bytes that were attempted to make a /// Consumes this error, returning the bytes that were attempted to make a
/// `String` with. /// `String` with.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_bytes(self) -> Vec<u8> { self.bytes } pub fn into_bytes(self) -> Vec<u8> { self.bytes }
/// Access the underlying UTF8-error that was the cause of this error. /// Accesss the underlying UTF8-error that was the cause of this error.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn utf8_error(&self) -> Utf8Error { self.error } pub fn utf8_error(&self) -> Utf8Error { self.error }
} }
@ -955,7 +955,7 @@ impl<'a> Deref for DerefString<'a> {
} }
} }
/// Convert a string slice to a wrapper type providing a `&String` reference. /// Converts a string slice to a wrapper type providing a `&String` reference.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -393,7 +393,7 @@ impl<T> Vec<T> {
} }
} }
/// Convert the vector into Box<[T]>. /// Converts the vector into Box<[T]>.
/// ///
/// Note that this will drop any excess capacity. Calling this and /// Note that this will drop any excess capacity. Calling this and
/// converting back to a vector with `into_vec()` is equivalent to calling /// converting back to a vector with `into_vec()` is equivalent to calling
@ -434,7 +434,7 @@ impl<T> Vec<T> {
} }
} }
/// Extract a slice containing the entire vector. /// Extracts a slice containing the entire vector.
#[inline] #[inline]
#[unstable(feature = "convert", #[unstable(feature = "convert",
reason = "waiting on RFC revision")] reason = "waiting on RFC revision")]
@ -1936,7 +1936,7 @@ impl<'a, T> Drop for DerefVec<'a, T> {
} }
} }
/// Convert a slice to a wrapper type providing a `&Vec<T>` reference. /// Converts a slice to a wrapper type providing a `&Vec<T>` reference.
#[unstable(feature = "collections")] #[unstable(feature = "collections")]
pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> { pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> {
unsafe { unsafe {

View file

@ -481,7 +481,7 @@ impl<T> VecDeque<T> {
} }
} }
/// Shorten a ringbuf, dropping excess elements from the back. /// Shortens a ringbuf, dropping excess elements from the back.
/// ///
/// If `len` is greater than the ringbuf's current length, this has no /// If `len` is greater than the ringbuf's current length, this has no
/// effect. /// effect.

View file

@ -452,7 +452,7 @@ impl<V> VecMap<V> {
Drain { iter: self.v.drain().enumerate().filter_map(filter) } Drain { iter: self.v.drain().enumerate().filter_map(filter) }
} }
/// Return the number of elements in the map. /// Returns the number of elements in the map.
/// ///
/// # Examples /// # Examples
/// ///
@ -470,7 +470,7 @@ impl<V> VecMap<V> {
self.v.iter().filter(|elt| elt.is_some()).count() self.v.iter().filter(|elt| elt.is_some()).count()
} }
/// Return true if the map contains no elements. /// Returns true if the map contains no elements.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -91,7 +91,7 @@ use marker::{Reflect, Sized};
/// [mod]: index.html /// [mod]: index.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Any: Reflect + 'static { pub trait Any: Reflect + 'static {
/// Get the `TypeId` of `self` /// Gets the `TypeId` of `self`.
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "this method will likely be replaced by an associated static")] reason = "this method will likely be replaced by an associated static")]
fn get_type_id(&self) -> TypeId; fn get_type_id(&self) -> TypeId;

View file

@ -211,7 +211,7 @@ impl<T:Copy> Cell<T> {
} }
} }
/// Get a reference to the underlying `UnsafeCell`. /// Gets a reference to the underlying `UnsafeCell`.
/// ///
/// # Unsafety /// # Unsafety
/// ///
@ -436,7 +436,7 @@ impl<T> RefCell<T> {
} }
} }
/// Get a reference to the underlying `UnsafeCell`. /// Gets a reference to the underlying `UnsafeCell`.
/// ///
/// This can be used to circumvent `RefCell`'s safety checks. /// This can be used to circumvent `RefCell`'s safety checks.
/// ///
@ -537,7 +537,7 @@ impl<'b, T> Deref for Ref<'b, T> {
} }
} }
/// Copy a `Ref`. /// Copies a `Ref`.
/// ///
/// The `RefCell` is already immutably borrowed, so this cannot fail. /// The `RefCell` is already immutably borrowed, so this cannot fail.
/// ///
@ -647,7 +647,7 @@ pub struct UnsafeCell<T> {
impl<T> !Sync for UnsafeCell<T> {} impl<T> !Sync for UnsafeCell<T> {}
impl<T> UnsafeCell<T> { impl<T> UnsafeCell<T> {
/// Construct a new instance of `UnsafeCell` which will wrap the specified /// Constructs a new instance of `UnsafeCell` which will wrap the specified
/// value. /// value.
/// ///
/// All access to the inner value through methods is `unsafe`, and it is highly discouraged to /// All access to the inner value through methods is `unsafe`, and it is highly discouraged to
@ -685,7 +685,7 @@ impl<T> UnsafeCell<T> {
&self.value as *const T as *mut T &self.value as *const T as *mut T
} }
/// Unwraps the value /// Unwraps the value.
/// ///
/// # Unsafety /// # Unsafety
/// ///

View file

@ -38,7 +38,7 @@ pub trait Clone : Sized {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn clone(&self) -> Self; fn clone(&self) -> Self;
/// Perform copy-assignment from `source`. /// Performs copy-assignment from `source`.
/// ///
/// `a.clone_from(&b)` is equivalent to `a = b.clone()` in functionality, /// `a.clone_from(&b)` is equivalent to `a = b.clone()` in functionality,
/// but can be overridden to reuse the resources of `a` to avoid unnecessary /// but can be overridden to reuse the resources of `a` to avoid unnecessary
@ -52,7 +52,7 @@ pub trait Clone : Sized {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized> Clone for &'a T { impl<'a, T: ?Sized> Clone for &'a T {
/// Return a shallow copy of the reference. /// Returns a shallow copy of the reference.
#[inline] #[inline]
fn clone(&self) -> &'a T { *self } fn clone(&self) -> &'a T { *self }
} }
@ -61,7 +61,7 @@ macro_rules! clone_impl {
($t:ty) => { ($t:ty) => {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Clone for $t { impl Clone for $t {
/// Return a deep copy of the value. /// Returns a deep copy of the value.
#[inline] #[inline]
fn clone(&self) -> $t { *self } fn clone(&self) -> $t { *self }
} }
@ -92,28 +92,28 @@ macro_rules! extern_fn_clone {
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "this may not be sufficient for fns with region parameters")] reason = "this may not be sufficient for fns with region parameters")]
impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType { impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType {
/// Return a copy of a function pointer /// Returns a copy of a function pointer.
#[inline] #[inline]
fn clone(&self) -> extern "Rust" fn($($A),*) -> ReturnType { *self } fn clone(&self) -> extern "Rust" fn($($A),*) -> ReturnType { *self }
} }
#[unstable(feature = "core", reason = "brand new")] #[unstable(feature = "core", reason = "brand new")]
impl<$($A,)* ReturnType> Clone for extern "C" fn($($A),*) -> ReturnType { impl<$($A,)* ReturnType> Clone for extern "C" fn($($A),*) -> ReturnType {
/// Return a copy of a function pointer /// Returns a copy of a function pointer.
#[inline] #[inline]
fn clone(&self) -> extern "C" fn($($A),*) -> ReturnType { *self } fn clone(&self) -> extern "C" fn($($A),*) -> ReturnType { *self }
} }
#[unstable(feature = "core", reason = "brand new")] #[unstable(feature = "core", reason = "brand new")]
impl<$($A,)* ReturnType> Clone for unsafe extern "Rust" fn($($A),*) -> ReturnType { impl<$($A,)* ReturnType> Clone for unsafe extern "Rust" fn($($A),*) -> ReturnType {
/// Return a copy of a function pointer /// Returns a copy of a function pointer.
#[inline] #[inline]
fn clone(&self) -> unsafe extern "Rust" fn($($A),*) -> ReturnType { *self } fn clone(&self) -> unsafe extern "Rust" fn($($A),*) -> ReturnType { *self }
} }
#[unstable(feature = "core", reason = "brand new")] #[unstable(feature = "core", reason = "brand new")]
impl<$($A,)* ReturnType> Clone for unsafe extern "C" fn($($A),*) -> ReturnType { impl<$($A,)* ReturnType> Clone for unsafe extern "C" fn($($A),*) -> ReturnType {
/// Return a copy of a function pointer /// Returns a copy of a function pointer.
#[inline] #[inline]
fn clone(&self) -> unsafe extern "C" fn($($A),*) -> ReturnType { *self } fn clone(&self) -> unsafe extern "C" fn($($A),*) -> ReturnType { *self }
} }

View file

@ -139,16 +139,16 @@ extern "rust-intrinsic" {
pub fn atomic_fence_rel(); pub fn atomic_fence_rel();
pub fn atomic_fence_acqrel(); pub fn atomic_fence_acqrel();
/// Abort the execution of the process. /// Aborts the execution of the process.
pub fn abort() -> !; pub fn abort() -> !;
/// Tell LLVM that this point in the code is not reachable, /// Tells LLVM that this point in the code is not reachable,
/// enabling further optimizations. /// enabling further optimizations.
/// ///
/// NB: This is very different from the `unreachable!()` macro! /// NB: This is very different from the `unreachable!()` macro!
pub fn unreachable() -> !; pub fn unreachable() -> !;
/// Inform the optimizer that a condition is always true. /// Informs the optimizer that a condition is always true.
/// If the condition is false, the behavior is undefined. /// If the condition is false, the behavior is undefined.
/// ///
/// No code is generated for this intrinsic, but the optimizer will try /// No code is generated for this intrinsic, but the optimizer will try
@ -158,7 +158,7 @@ extern "rust-intrinsic" {
/// own, or if it does not enable any significant optimizations. /// own, or if it does not enable any significant optimizations.
pub fn assume(b: bool); pub fn assume(b: bool);
/// Execute a breakpoint trap, for inspection by a debugger. /// Executes a breakpoint trap, for inspection by a debugger.
pub fn breakpoint(); pub fn breakpoint();
/// The size of a type in bytes. /// The size of a type in bytes.
@ -170,7 +170,7 @@ extern "rust-intrinsic" {
/// elements. /// elements.
pub fn size_of<T>() -> usize; pub fn size_of<T>() -> usize;
/// Move a value to an uninitialized memory location. /// Moves a value to an uninitialized memory location.
/// ///
/// Drop glue is not run on the destination. /// Drop glue is not run on the destination.
pub fn move_val_init<T>(dst: &mut T, src: T); pub fn move_val_init<T>(dst: &mut T, src: T);
@ -186,7 +186,7 @@ extern "rust-intrinsic" {
/// crate it is invoked in. /// crate it is invoked in.
pub fn type_id<T: ?Sized + 'static>() -> u64; pub fn type_id<T: ?Sized + 'static>() -> u64;
/// Create a value initialized to so that its drop flag, /// Creates a value initialized to so that its drop flag,
/// if any, says that it has been dropped. /// if any, says that it has been dropped.
/// ///
/// `init_dropped` is unsafe because it returns a datum with all /// `init_dropped` is unsafe because it returns a datum with all
@ -199,7 +199,7 @@ extern "rust-intrinsic" {
/// intrinsic). /// intrinsic).
pub fn init_dropped<T>() -> T; pub fn init_dropped<T>() -> T;
/// Create a value initialized to zero. /// Creates a value initialized to zero.
/// ///
/// `init` is unsafe because it returns a zeroed-out datum, /// `init` is unsafe because it returns a zeroed-out datum,
/// which is unsafe unless T is `Copy`. Also, even if T is /// which is unsafe unless T is `Copy`. Also, even if T is
@ -207,7 +207,7 @@ extern "rust-intrinsic" {
/// state for the type in question. /// state for the type in question.
pub fn init<T>() -> T; pub fn init<T>() -> T;
/// Create an uninitialized value. /// Creates an uninitialized value.
/// ///
/// `uninit` is unsafe because there is no guarantee of what its /// `uninit` is unsafe because there is no guarantee of what its
/// contents are. In particular its drop-flag may be set to any /// contents are. In particular its drop-flag may be set to any
@ -216,7 +216,7 @@ extern "rust-intrinsic" {
/// initialize memory previous set to the result of `uninit`. /// initialize memory previous set to the result of `uninit`.
pub fn uninit<T>() -> T; pub fn uninit<T>() -> T;
/// Move a value out of scope without running drop glue. /// Moves a value out of scope without running drop glue.
/// ///
/// `forget` is unsafe because the caller is responsible for /// `forget` is unsafe because the caller is responsible for
/// ensuring the argument is deallocated already. /// ensuring the argument is deallocated already.

View file

@ -91,7 +91,7 @@ pub trait Iterator {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Item; type Item;
/// Advance the iterator and return the next value. Return `None` when the /// Advances the iterator and returns the next value. Returns `None` when the
/// end is reached. /// end is reached.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn next(&mut self) -> Option<Self::Item>; fn next(&mut self) -> Option<Self::Item>;
@ -670,7 +670,7 @@ pub trait Iterator {
None None
} }
/// Return the index of the first element satisfying the specified predicate /// Returns the index of the first element satisfying the specified predicate
/// ///
/// Does not consume the iterator past the first found element. /// Does not consume the iterator past the first found element.
/// ///
@ -698,7 +698,7 @@ pub trait Iterator {
None None
} }
/// Return the index of the last element satisfying the specified predicate /// Returns the index of the last element satisfying the specified predicate
/// ///
/// If no element matches, None is returned. /// If no element matches, None is returned.
/// ///
@ -853,7 +853,7 @@ pub trait Iterator {
MinMax(min, max) MinMax(min, max)
} }
/// Return the element that gives the maximum value from the /// Returns the element that gives the maximum value from the
/// specified function. /// specified function.
/// ///
/// Returns the rightmost element if the comparison determines two elements /// Returns the rightmost element if the comparison determines two elements
@ -882,7 +882,7 @@ pub trait Iterator {
.map(|(_, x)| x) .map(|(_, x)| x)
} }
/// Return the element that gives the minimum value from the /// Returns the element that gives the minimum value from the
/// specified function. /// specified function.
/// ///
/// Returns the leftmost element if the comparison determines two elements /// Returns the leftmost element if the comparison determines two elements
@ -1099,7 +1099,7 @@ impl<'a, I: Iterator + ?Sized> Iterator for &'a mut I {
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \ #[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
built from an iterator over elements of type `{A}`"] built from an iterator over elements of type `{A}`"]
pub trait FromIterator<A> { pub trait FromIterator<A> {
/// Build a container with elements from something iterable. /// Builds a container with elements from something iterable.
/// ///
/// # Examples /// # Examples
/// ///
@ -1158,7 +1158,7 @@ impl<I: Iterator> IntoIterator for I {
/// A type growable from an `Iterator` implementation /// A type growable from an `Iterator` implementation
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Extend<A> { pub trait Extend<A> {
/// Extend a container with the elements yielded by an arbitrary iterator /// Extends a container with the elements yielded by an arbitrary iterator
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn extend<T: IntoIterator<Item=A>>(&mut self, iterable: T); fn extend<T: IntoIterator<Item=A>>(&mut self, iterable: T);
} }
@ -1170,7 +1170,7 @@ pub trait Extend<A> {
/// independently of each other. /// independently of each other.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait DoubleEndedIterator: Iterator { pub trait DoubleEndedIterator: Iterator {
/// Yield an element from the end of the range, returning `None` if the /// Yields an element from the end of the range, returning `None` if the
/// range is empty. /// range is empty.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn next_back(&mut self) -> Option<Self::Item>; fn next_back(&mut self) -> Option<Self::Item>;
@ -1191,11 +1191,11 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
reason = "not widely used, may be better decomposed into Index \ reason = "not widely used, may be better decomposed into Index \
and ExactSizeIterator")] and ExactSizeIterator")]
pub trait RandomAccessIterator: Iterator { pub trait RandomAccessIterator: Iterator {
/// Return the number of indexable elements. At most `std::usize::MAX` /// Returns the number of indexable elements. At most `std::usize::MAX`
/// elements are indexable, even if the iterator represents a longer range. /// elements are indexable, even if the iterator represents a longer range.
fn indexable(&self) -> usize; fn indexable(&self) -> usize;
/// Return an element at an index, or `None` if the index is out of bounds /// Returns an element at an index, or `None` if the index is out of bounds
fn idx(&mut self, index: usize) -> Option<Self::Item>; fn idx(&mut self, index: usize) -> Option<Self::Item>;
} }
@ -1210,7 +1210,7 @@ pub trait RandomAccessIterator: Iterator {
pub trait ExactSizeIterator: Iterator { pub trait ExactSizeIterator: Iterator {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
/// Return the exact length of the iterator. /// Returns the exact length of the iterator.
fn len(&self) -> usize { fn len(&self) -> usize {
let (lower, upper) = self.size_hint(); let (lower, upper) = self.size_hint();
// Note: This assertion is overly defensive, but it checks the invariant // Note: This assertion is overly defensive, but it checks the invariant
@ -1856,7 +1856,7 @@ impl<I: ExactSizeIterator> ExactSizeIterator for Peekable<I> {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I: Iterator> Peekable<I> { impl<I: Iterator> Peekable<I> {
/// Return a reference to the next element of the iterator with out /// Returns a reference to the next element of the iterator with out
/// advancing it, or None if the iterator is exhausted. /// advancing it, or None if the iterator is exhausted.
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1870,7 +1870,7 @@ impl<I: Iterator> Peekable<I> {
} }
} }
/// Check whether peekable iterator is empty or not. /// Checks whether peekable iterator is empty or not.
#[inline] #[inline]
pub fn is_empty(&mut self) -> bool { pub fn is_empty(&mut self) -> bool {
self.peek().is_none() self.peek().is_none()
@ -2401,12 +2401,12 @@ pub trait Step: PartialOrd {
/// Steps `self` if possible. /// Steps `self` if possible.
fn step(&self, by: &Self) -> Option<Self>; fn step(&self, by: &Self) -> Option<Self>;
/// The number of steps between two step objects. /// Returns the number of steps between two step objects.
/// ///
/// `start` should always be less than `end`, so the result should never /// `start` should always be less than `end`, so the result should never
/// be negative. /// be negative.
/// ///
/// Return `None` if it is not possible to calculate steps_between /// Returns `None` if it is not possible to calculate steps_between
/// without overflow. /// without overflow.
fn steps_between(start: &Self, end: &Self, by: &Self) -> Option<usize>; fn steps_between(start: &Self, end: &Self, by: &Self) -> Option<usize>;
} }
@ -2549,7 +2549,7 @@ pub struct RangeInclusive<A> {
done: bool, done: bool,
} }
/// Return an iterator over the range [start, stop] /// Returns an iterator over the range [start, stop].
#[inline] #[inline]
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "likely to be replaced by range notation and adapters")] reason = "likely to be replaced by range notation and adapters")]
@ -2657,7 +2657,7 @@ pub struct RangeStepInclusive<A> {
done: bool, done: bool,
} }
/// Return an iterator over the range [start, stop] by `step`. /// Returns an iterator over the range [start, stop] by `step`.
/// ///
/// It handles overflow by stopping. /// It handles overflow by stopping.
/// ///
@ -2827,7 +2827,7 @@ type IterateState<T, F> = (F, Option<T>, bool);
#[unstable(feature = "core")] #[unstable(feature = "core")]
pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>; pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
/// Create a new iterator that produces an infinite sequence of /// Creates a new iterator that produces an infinite sequence of
/// repeated applications of the given function `f`. /// repeated applications of the given function `f`.
#[unstable(feature = "core")] #[unstable(feature = "core")]
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
@ -2853,7 +2853,7 @@ pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
Unfold::new((f, Some(seed), true), next) Unfold::new((f, Some(seed), true), next)
} }
/// Create a new iterator that endlessly repeats the element `elt`. /// Creates a new iterator that endlessly repeats the element `elt`.
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
@ -2940,7 +2940,7 @@ pub mod order {
} }
} }
/// Compare `a` and `b` for nonequality (Using partial equality, `PartialEq`) /// Compares `a` and `b` for nonequality (Using partial equality, `PartialEq`)
pub fn ne<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where pub fn ne<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
L::Item: PartialEq<R::Item>, L::Item: PartialEq<R::Item>,
{ {
@ -2953,7 +2953,7 @@ pub mod order {
} }
} }
/// Return `a` < `b` lexicographically (Using partial order, `PartialOrd`) /// Returns `a` < `b` lexicographically (Using partial order, `PartialOrd`)
pub fn lt<R: Iterator, L: Iterator>(mut a: L, mut b: R) -> bool where pub fn lt<R: Iterator, L: Iterator>(mut a: L, mut b: R) -> bool where
L::Item: PartialOrd<R::Item>, L::Item: PartialOrd<R::Item>,
{ {
@ -2967,7 +2967,7 @@ pub mod order {
} }
} }
/// Return `a` <= `b` lexicographically (Using partial order, `PartialOrd`) /// Returns `a` <= `b` lexicographically (Using partial order, `PartialOrd`)
pub fn le<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where pub fn le<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
L::Item: PartialOrd<R::Item>, L::Item: PartialOrd<R::Item>,
{ {
@ -2981,7 +2981,7 @@ pub mod order {
} }
} }
/// Return `a` > `b` lexicographically (Using partial order, `PartialOrd`) /// Returns `a` > `b` lexicographically (Using partial order, `PartialOrd`)
pub fn gt<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where pub fn gt<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
L::Item: PartialOrd<R::Item>, L::Item: PartialOrd<R::Item>,
{ {
@ -2995,7 +2995,7 @@ pub mod order {
} }
} }
/// Return `a` >= `b` lexicographically (Using partial order, `PartialOrd`) /// Returns `a` >= `b` lexicographically (Using partial order, `PartialOrd`)
pub fn ge<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where pub fn ge<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
L::Item: PartialOrd<R::Item>, L::Item: PartialOrd<R::Item>,
{ {

View file

@ -134,7 +134,7 @@ pub fn align_of_val<T>(_val: &T) -> usize {
align_of::<T>() align_of::<T>()
} }
/// Create a value initialized to zero. /// Creates a value initialized to zero.
/// ///
/// This function is similar to allocating space for a local variable and zeroing it out (an unsafe /// This function is similar to allocating space for a local variable and zeroing it out (an unsafe
/// operation). /// operation).
@ -158,7 +158,7 @@ pub unsafe fn zeroed<T>() -> T {
intrinsics::init() intrinsics::init()
} }
/// Create a value initialized to an unspecified series of bytes. /// Creates a value initialized to an unspecified series of bytes.
/// ///
/// The byte sequence usually indicates that the value at the memory /// The byte sequence usually indicates that the value at the memory
/// in question has been dropped. Thus, *if* T carries a drop flag, /// in question has been dropped. Thus, *if* T carries a drop flag,
@ -179,7 +179,7 @@ pub unsafe fn dropped<T>() -> T {
dropped_impl() dropped_impl()
} }
/// Create an uninitialized value. /// Creates an uninitialized value.
/// ///
/// Care must be taken when using this function, if the type `T` has a destructor and the value /// Care must be taken when using this function, if the type `T` has a destructor and the value
/// falls out of scope (due to unwinding or returning) before being initialized, then the /// falls out of scope (due to unwinding or returning) before being initialized, then the
@ -234,7 +234,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
} }
} }
/// Replace the value at a mutable location with a new one, returning the old value, without /// Replaces the value at a mutable location with a new one, returning the old value, without
/// deinitialising or copying either one. /// deinitialising or copying either one.
/// ///
/// This is primarily used for transferring and swapping ownership of a value in a mutable /// This is primarily used for transferring and swapping ownership of a value in a mutable

View file

@ -38,7 +38,7 @@ unsafe impl Zeroable for u64 {}
pub struct NonZero<T: Zeroable>(T); pub struct NonZero<T: Zeroable>(T);
impl<T: Zeroable> NonZero<T> { impl<T: Zeroable> NonZero<T> {
/// Create an instance of NonZero with the provided value. /// Creates an instance of NonZero with the provided value.
/// You must indeed ensure that the value is actually "non-zero". /// You must indeed ensure that the value is actually "non-zero".
#[inline(always)] #[inline(always)]
pub unsafe fn new(inner: T) -> NonZero<T> { pub unsafe fn new(inner: T) -> NonZero<T> {

View file

@ -268,7 +268,7 @@ pub trait Int
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn swap_bytes(self) -> Self; fn swap_bytes(self) -> Self;
/// Convert an integer from big endian to the target's endianness. /// Converts an integer from big endian to the target's endianness.
/// ///
/// On big endian this is a no-op. On little endian the bytes are swapped. /// On big endian this is a no-op. On little endian the bytes are swapped.
/// ///
@ -291,7 +291,7 @@ pub trait Int
if cfg!(target_endian = "big") { x } else { x.swap_bytes() } if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
} }
/// Convert an integer from little endian to the target's endianness. /// Converts an integer from little endian to the target's endianness.
/// ///
/// On little endian this is a no-op. On big endian the bytes are swapped. /// On little endian this is a no-op. On big endian the bytes are swapped.
/// ///
@ -314,7 +314,7 @@ pub trait Int
if cfg!(target_endian = "little") { x } else { x.swap_bytes() } if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
} }
/// Convert `self` to big endian from the target's endianness. /// Converts `self` to big endian from the target's endianness.
/// ///
/// On big endian this is a no-op. On little endian the bytes are swapped. /// On big endian this is a no-op. On little endian the bytes are swapped.
/// ///
@ -337,7 +337,7 @@ pub trait Int
if cfg!(target_endian = "big") { self } else { self.swap_bytes() } if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
} }
/// Convert `self` to little endian from the target's endianness. /// Converts `self` to little endian from the target's endianness.
/// ///
/// On little endian this is a no-op. On big endian the bytes are swapped. /// On little endian this is a no-op. On big endian the bytes are swapped.
/// ///
@ -845,7 +845,7 @@ macro_rules! int_impl {
let min: $T = Int::min_value(); !min let min: $T = Int::min_value(); !min
} }
/// Convert a string slice in a given base to an integer. /// Converts a string slice in a given base to an integer.
/// ///
/// Leading and trailing whitespace represent an error. /// Leading and trailing whitespace represent an error.
/// ///
@ -995,7 +995,7 @@ macro_rules! int_impl {
(self as $UnsignedT).swap_bytes() as $T (self as $UnsignedT).swap_bytes() as $T
} }
/// Convert an integer from big endian to the target's endianness. /// Converts an integer from big endian to the target's endianness.
/// ///
/// On big endian this is a no-op. On little endian the bytes are /// On big endian this is a no-op. On little endian the bytes are
/// swapped. /// swapped.
@ -1019,7 +1019,7 @@ macro_rules! int_impl {
if cfg!(target_endian = "big") { x } else { x.swap_bytes() } if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
} }
/// Convert an integer from little endian to the target's endianness. /// Converts an integer from little endian to the target's endianness.
/// ///
/// On little endian this is a no-op. On big endian the bytes are /// On little endian this is a no-op. On big endian the bytes are
/// swapped. /// swapped.
@ -1043,7 +1043,7 @@ macro_rules! int_impl {
if cfg!(target_endian = "little") { x } else { x.swap_bytes() } if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
} }
/// Convert `self` to big endian from the target's endianness. /// Converts `self` to big endian from the target's endianness.
/// ///
/// On big endian this is a no-op. On little endian the bytes are /// On big endian this is a no-op. On little endian the bytes are
/// swapped. /// swapped.
@ -1067,7 +1067,7 @@ macro_rules! int_impl {
if cfg!(target_endian = "big") { self } else { self.swap_bytes() } if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
} }
/// Convert `self` to little endian from the target's endianness. /// Converts `self` to little endian from the target's endianness.
/// ///
/// On little endian this is a no-op. On big endian the bytes are /// On little endian this is a no-op. On big endian the bytes are
/// swapped. /// swapped.
@ -1361,7 +1361,7 @@ macro_rules! uint_impl {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn max_value() -> $T { !0 } pub fn max_value() -> $T { !0 }
/// Convert a string slice in a given base to an integer. /// Converts a string slice in a given base to an integer.
/// ///
/// Leading and trailing whitespace represent an error. /// Leading and trailing whitespace represent an error.
/// ///
@ -1517,7 +1517,7 @@ macro_rules! uint_impl {
unsafe { $bswap(self as $ActualT) as $T } unsafe { $bswap(self as $ActualT) as $T }
} }
/// Convert an integer from big endian to the target's endianness. /// Converts an integer from big endian to the target's endianness.
/// ///
/// On big endian this is a no-op. On little endian the bytes are /// On big endian this is a no-op. On little endian the bytes are
/// swapped. /// swapped.
@ -1541,7 +1541,7 @@ macro_rules! uint_impl {
if cfg!(target_endian = "big") { x } else { x.swap_bytes() } if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
} }
/// Convert an integer from little endian to the target's endianness. /// Converts an integer from little endian to the target's endianness.
/// ///
/// On little endian this is a no-op. On big endian the bytes are /// On little endian this is a no-op. On big endian the bytes are
/// swapped. /// swapped.
@ -1565,7 +1565,7 @@ macro_rules! uint_impl {
if cfg!(target_endian = "little") { x } else { x.swap_bytes() } if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
} }
/// Convert `self` to big endian from the target's endianness. /// Converts `self` to big endian from the target's endianness.
/// ///
/// On big endian this is a no-op. On little endian the bytes are /// On big endian this is a no-op. On little endian the bytes are
/// swapped. /// swapped.
@ -1589,7 +1589,7 @@ macro_rules! uint_impl {
if cfg!(target_endian = "big") { self } else { self.swap_bytes() } if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
} }
/// Convert `self` to little endian from the target's endianness. /// Converts `self` to little endian from the target's endianness.
/// ///
/// On little endian this is a no-op. On big endian the bytes are /// On little endian this is a no-op. On big endian the bytes are
/// swapped. /// swapped.
@ -2183,7 +2183,7 @@ impl_to_primitive_float! { f64 }
/// A generic trait for converting a number to a value. /// A generic trait for converting a number to a value.
#[unstable(feature = "core", reason = "trait is likely to be removed")] #[unstable(feature = "core", reason = "trait is likely to be removed")]
pub trait FromPrimitive : ::marker::Sized { pub trait FromPrimitive : ::marker::Sized {
/// Convert an `isize` to return an optional value of this type. If the /// Converts an `isize` to return an optional value of this type. If the
/// value cannot be represented by this value, the `None` is returned. /// value cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
#[unstable(feature = "core")] #[unstable(feature = "core")]
@ -2192,39 +2192,39 @@ pub trait FromPrimitive : ::marker::Sized {
FromPrimitive::from_i64(n as i64) FromPrimitive::from_i64(n as i64)
} }
/// Convert an `isize` to return an optional value of this type. If the /// Converts an `isize` to return an optional value of this type. If the
/// value cannot be represented by this value, the `None` is returned. /// value cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_isize(n: isize) -> Option<Self> { fn from_isize(n: isize) -> Option<Self> {
FromPrimitive::from_i64(n as i64) FromPrimitive::from_i64(n as i64)
} }
/// Convert an `i8` to return an optional value of this type. If the /// Converts an `i8` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_i8(n: i8) -> Option<Self> { fn from_i8(n: i8) -> Option<Self> {
FromPrimitive::from_i64(n as i64) FromPrimitive::from_i64(n as i64)
} }
/// Convert an `i16` to return an optional value of this type. If the /// Converts an `i16` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_i16(n: i16) -> Option<Self> { fn from_i16(n: i16) -> Option<Self> {
FromPrimitive::from_i64(n as i64) FromPrimitive::from_i64(n as i64)
} }
/// Convert an `i32` to return an optional value of this type. If the /// Converts an `i32` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_i32(n: i32) -> Option<Self> { fn from_i32(n: i32) -> Option<Self> {
FromPrimitive::from_i64(n as i64) FromPrimitive::from_i64(n as i64)
} }
/// Convert an `i64` to return an optional value of this type. If the /// Converts an `i64` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
fn from_i64(n: i64) -> Option<Self>; fn from_i64(n: i64) -> Option<Self>;
/// Convert an `usize` to return an optional value of this type. If the /// Converts an `usize` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
#[unstable(feature = "core")] #[unstable(feature = "core")]
@ -2233,46 +2233,46 @@ pub trait FromPrimitive : ::marker::Sized {
FromPrimitive::from_u64(n as u64) FromPrimitive::from_u64(n as u64)
} }
/// Convert a `usize` to return an optional value of this type. If the /// Converts a `usize` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_usize(n: usize) -> Option<Self> { fn from_usize(n: usize) -> Option<Self> {
FromPrimitive::from_u64(n as u64) FromPrimitive::from_u64(n as u64)
} }
/// Convert an `u8` to return an optional value of this type. If the /// Converts an `u8` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_u8(n: u8) -> Option<Self> { fn from_u8(n: u8) -> Option<Self> {
FromPrimitive::from_u64(n as u64) FromPrimitive::from_u64(n as u64)
} }
/// Convert an `u16` to return an optional value of this type. If the /// Converts an `u16` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_u16(n: u16) -> Option<Self> { fn from_u16(n: u16) -> Option<Self> {
FromPrimitive::from_u64(n as u64) FromPrimitive::from_u64(n as u64)
} }
/// Convert an `u32` to return an optional value of this type. If the /// Converts an `u32` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_u32(n: u32) -> Option<Self> { fn from_u32(n: u32) -> Option<Self> {
FromPrimitive::from_u64(n as u64) FromPrimitive::from_u64(n as u64)
} }
/// Convert an `u64` to return an optional value of this type. If the /// Converts an `u64` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
fn from_u64(n: u64) -> Option<Self>; fn from_u64(n: u64) -> Option<Self>;
/// Convert a `f32` to return an optional value of this type. If the /// Converts a `f32` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_f32(n: f32) -> Option<Self> { fn from_f32(n: f32) -> Option<Self> {
FromPrimitive::from_f64(n as f64) FromPrimitive::from_f64(n as f64)
} }
/// Convert a `f64` to return an optional value of this type. If the /// Converts a `f64` to return an optional value of this type. If the
/// type cannot be represented by this value, the `None` is returned. /// type cannot be represented by this value, the `None` is returned.
#[inline] #[inline]
fn from_f64(n: f64) -> Option<Self> { fn from_f64(n: f64) -> Option<Self> {
@ -2401,7 +2401,7 @@ impl_from_primitive! { u64, to_u64 }
impl_from_primitive! { f32, to_f32 } impl_from_primitive! { f32, to_f32 }
impl_from_primitive! { f64, to_f64 } impl_from_primitive! { f64, to_f64 }
/// Cast from one machine scalar to another. /// Casts from one machine scalar to another.
/// ///
/// # Examples /// # Examples
/// ///
@ -2583,16 +2583,16 @@ pub trait Float
/// Returns the mantissa, exponent and sign as integers, respectively. /// Returns the mantissa, exponent and sign as integers, respectively.
fn integer_decode(self) -> (u64, i16, i8); fn integer_decode(self) -> (u64, i16, i8);
/// Return the largest integer less than or equal to a number. /// Returns the largest integer less than or equal to a number.
fn floor(self) -> Self; fn floor(self) -> Self;
/// Return the smallest integer greater than or equal to a number. /// Returns the smallest integer greater than or equal to a number.
fn ceil(self) -> Self; fn ceil(self) -> Self;
/// Return the nearest integer to a number. Round half-way cases away from /// Returns the nearest integer to a number. Round half-way cases away from
/// `0.0`. /// `0.0`.
fn round(self) -> Self; fn round(self) -> Self;
/// Return the integer part of a number. /// Returns the integer part of a number.
fn trunc(self) -> Self; fn trunc(self) -> Self;
/// Return the fractional part of a number. /// Returns the fractional part of a number.
fn fract(self) -> Self; fn fract(self) -> Self;
/// Computes the absolute value of `self`. Returns `Float::nan()` if the /// Computes the absolute value of `self`. Returns `Float::nan()` if the
@ -2615,21 +2615,21 @@ pub trait Float
/// error. This produces a more accurate result with better performance than /// error. This produces a more accurate result with better performance than
/// a separate multiplication operation followed by an add. /// a separate multiplication operation followed by an add.
fn mul_add(self, a: Self, b: Self) -> Self; fn mul_add(self, a: Self, b: Self) -> Self;
/// Take the reciprocal (inverse) of a number, `1/x`. /// Takes the reciprocal (inverse) of a number, `1/x`.
fn recip(self) -> Self; fn recip(self) -> Self;
/// Raise a number to an integer power. /// Raises a number to an integer power.
/// ///
/// Using this function is generally faster than using `powf` /// Using this function is generally faster than using `powf`
fn powi(self, n: i32) -> Self; fn powi(self, n: i32) -> Self;
/// Raise a number to a floating point power. /// Raises a number to a floating point power.
fn powf(self, n: Self) -> Self; fn powf(self, n: Self) -> Self;
/// Take the square root of a number. /// Takes the square root of a number.
/// ///
/// Returns NaN if `self` is a negative number. /// Returns NaN if `self` is a negative number.
fn sqrt(self) -> Self; fn sqrt(self) -> Self;
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
fn rsqrt(self) -> Self; fn rsqrt(self) -> Self;
/// Returns `e^(self)`, (the exponential function). /// Returns `e^(self)`, (the exponential function).
@ -2645,9 +2645,9 @@ pub trait Float
/// Returns the base 10 logarithm of the number. /// Returns the base 10 logarithm of the number.
fn log10(self) -> Self; fn log10(self) -> Self;
/// Convert radians to degrees. /// Converts radians to degrees.
fn to_degrees(self) -> Self; fn to_degrees(self) -> Self;
/// Convert degrees to radians. /// Converts degrees to radians.
fn to_radians(self) -> Self; fn to_radians(self) -> Self;
} }
@ -2682,7 +2682,7 @@ macro_rules! from_str_radix_float_impl {
impl FromStr for $T { impl FromStr for $T {
type Err = ParseFloatError; type Err = ParseFloatError;
/// Convert a string in base 10 to a float. /// Converts a string in base 10 to a float.
/// Accepts an optional decimal exponent. /// Accepts an optional decimal exponent.
/// ///
/// This function accepts strings such as /// This function accepts strings such as
@ -2719,7 +2719,7 @@ macro_rules! from_str_radix_float_impl {
impl FromStrRadix for $T { impl FromStrRadix for $T {
type Err = ParseFloatError; type Err = ParseFloatError;
/// Convert a string in a given base to a float. /// Converts a string in a given base to a float.
/// ///
/// Due to possible conflicts, this function does **not** accept /// Due to possible conflicts, this function does **not** accept
/// the special values `inf`, `-inf`, `+inf` and `NaN`, **nor** /// the special values `inf`, `-inf`, `+inf` and `NaN`, **nor**

View file

@ -223,7 +223,7 @@ impl<T> Option<T> {
// Adapter for working with references // Adapter for working with references
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
/// Convert from `Option<T>` to `Option<&T>` /// Converts from `Option<T>` to `Option<&T>`
/// ///
/// # Examples /// # Examples
/// ///
@ -248,7 +248,7 @@ impl<T> Option<T> {
} }
} }
/// Convert from `Option<T>` to `Option<&mut T>` /// Converts from `Option<T>` to `Option<&mut T>`
/// ///
/// # Examples /// # Examples
/// ///
@ -269,7 +269,7 @@ impl<T> Option<T> {
} }
} }
/// Convert from `Option<T>` to `&mut [T]` (without copying) /// Converts from `Option<T>` to `&mut [T]` (without copying)
/// ///
/// # Examples /// # Examples
/// ///
@ -704,7 +704,7 @@ impl<T> Option<T> {
mem::replace(self, None) mem::replace(self, None)
} }
/// Convert from `Option<T>` to `&[T]` (without copying) /// Converts from `Option<T>` to `&[T]` (without copying)
#[inline] #[inline]
#[unstable(feature = "as_slice", since = "unsure of the utility here")] #[unstable(feature = "as_slice", since = "unsure of the utility here")]
pub fn as_slice<'a>(&'a self) -> &'a [T] { pub fn as_slice<'a>(&'a self) -> &'a [T] {

View file

@ -544,19 +544,19 @@ unsafe impl<T: Send + ?Sized> Send for Unique<T> { }
unsafe impl<T: Sync + ?Sized> Sync for Unique<T> { } unsafe impl<T: Sync + ?Sized> Sync for Unique<T> { }
impl<T: ?Sized> Unique<T> { impl<T: ?Sized> Unique<T> {
/// Create a new `Unique`. /// Creates a new `Unique`.
#[unstable(feature = "unique")] #[unstable(feature = "unique")]
pub unsafe fn new(ptr: *mut T) -> Unique<T> { pub unsafe fn new(ptr: *mut T) -> Unique<T> {
Unique { pointer: NonZero::new(ptr), _marker: PhantomData } Unique { pointer: NonZero::new(ptr), _marker: PhantomData }
} }
/// Dereference the content. /// Dereferences the content.
#[unstable(feature = "unique")] #[unstable(feature = "unique")]
pub unsafe fn get(&self) -> &T { pub unsafe fn get(&self) -> &T {
&**self.pointer &**self.pointer
} }
/// Mutably dereference the content. /// Mutably dereferences the content.
#[unstable(feature = "unique")] #[unstable(feature = "unique")]
pub unsafe fn get_mut(&mut self) -> &mut T { pub unsafe fn get_mut(&mut self) -> &mut T {
&mut ***self &mut ***self

View file

@ -305,7 +305,7 @@ impl<T, E> Result<T, E> {
// Adapter for each variant // Adapter for each variant
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
/// Convert from `Result<T, E>` to `Option<T>` /// Converts from `Result<T, E>` to `Option<T>`
/// ///
/// Converts `self` into an `Option<T>`, consuming `self`, /// Converts `self` into an `Option<T>`, consuming `self`,
/// and discarding the error, if any. /// and discarding the error, if any.
@ -328,7 +328,7 @@ impl<T, E> Result<T, E> {
} }
} }
/// Convert from `Result<T, E>` to `Option<E>` /// Converts from `Result<T, E>` to `Option<E>`
/// ///
/// Converts `self` into an `Option<E>`, consuming `self`, /// Converts `self` into an `Option<E>`, consuming `self`,
/// and discarding the success value, if any. /// and discarding the success value, if any.
@ -355,7 +355,7 @@ impl<T, E> Result<T, E> {
// Adapter for working with references // Adapter for working with references
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
/// Convert from `Result<T, E>` to `Result<&T, &E>` /// Converts from `Result<T, E>` to `Result<&T, &E>`
/// ///
/// Produces a new `Result`, containing a reference /// Produces a new `Result`, containing a reference
/// into the original, leaving the original in place. /// into the original, leaving the original in place.
@ -376,7 +376,7 @@ impl<T, E> Result<T, E> {
} }
} }
/// Convert from `Result<T, E>` to `Result<&mut T, &mut E>` /// Converts from `Result<T, E>` to `Result<&mut T, &mut E>`
/// ///
/// ``` /// ```
/// fn mutate(r: &mut Result<i32, i32>) { /// fn mutate(r: &mut Result<i32, i32>) {
@ -403,7 +403,7 @@ impl<T, E> Result<T, E> {
} }
} }
/// Convert from `Result<T, E>` to `&[T]` (without copying) /// Converts from `Result<T, E>` to `&[T]` (without copying)
#[inline] #[inline]
#[unstable(feature = "as_slice", since = "unsure of the utility here")] #[unstable(feature = "as_slice", since = "unsure of the utility here")]
pub fn as_slice(&self) -> &[T] { pub fn as_slice(&self) -> &[T] {
@ -417,7 +417,7 @@ impl<T, E> Result<T, E> {
} }
} }
/// Convert from `Result<T, E>` to `&mut [T]` (without copying) /// Converts from `Result<T, E>` to `&mut [T]` (without copying)
/// ///
/// ``` /// ```
/// # #![feature(core)] /// # #![feature(core)]
@ -793,7 +793,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
reason = "use inherent method instead")] reason = "use inherent method instead")]
#[allow(deprecated)] #[allow(deprecated)]
impl<T, E> AsSlice<T> for Result<T, E> { impl<T, E> AsSlice<T> for Result<T, E> {
/// Convert from `Result<T, E>` to `&[T]` (without copying) /// Converts from `Result<T, E>` to `&[T]` (without copying)
#[inline] #[inline]
fn as_slice<'a>(&'a self) -> &'a [T] { fn as_slice<'a>(&'a self) -> &'a [T] {
match *self { match *self {
@ -956,7 +956,7 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
// FromIterator // FromIterator
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/// Perform a fold operation over the result values from an iterator. /// Performs a fold operation over the result values from an iterator.
/// ///
/// If an `Err` is encountered, it is immediately returned. /// If an `Err` is encountered, it is immediately returned.
/// Otherwise, the folded value is returned. /// Otherwise, the folded value is returned.

View file

@ -32,17 +32,17 @@ pub trait Pattern<'a>: Sized {
/// Associated searcher for this pattern /// Associated searcher for this pattern
type Searcher: Searcher<'a>; type Searcher: Searcher<'a>;
/// Construct the associated searcher from /// Constructs the associated searcher from
/// `self` and the `haystack` to search in. /// `self` and the `haystack` to search in.
fn into_searcher(self, haystack: &'a str) -> Self::Searcher; fn into_searcher(self, haystack: &'a str) -> Self::Searcher;
/// Check whether the pattern matches anywhere in the haystack /// Checks whether the pattern matches anywhere in the haystack
#[inline] #[inline]
fn is_contained_in(self, haystack: &'a str) -> bool { fn is_contained_in(self, haystack: &'a str) -> bool {
self.into_searcher(haystack).next_match().is_some() self.into_searcher(haystack).next_match().is_some()
} }
/// Check whether the pattern matches at the front of the haystack /// Checks whether the pattern matches at the front of the haystack
#[inline] #[inline]
fn is_prefix_of(self, haystack: &'a str) -> bool { fn is_prefix_of(self, haystack: &'a str) -> bool {
match self.into_searcher(haystack).next() { match self.into_searcher(haystack).next() {
@ -51,7 +51,7 @@ pub trait Pattern<'a>: Sized {
} }
} }
/// Check whether the pattern matches at the back of the haystack /// Checks whether the pattern matches at the back of the haystack
#[inline] #[inline]
fn is_suffix_of(self, haystack: &'a str) -> bool fn is_suffix_of(self, haystack: &'a str) -> bool
where Self::Searcher: ReverseSearcher<'a> where Self::Searcher: ReverseSearcher<'a>

View file

@ -23,12 +23,12 @@ use mem;
#[unstable(feature = "std_misc", #[unstable(feature = "std_misc",
reason = "would prefer to do this in a more general way")] reason = "would prefer to do this in a more general way")]
pub trait OwnedAsciiExt { pub trait OwnedAsciiExt {
/// Convert the string to ASCII upper case: /// Converts the string to ASCII upper case:
/// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
/// but non-ASCII letters are unchanged. /// but non-ASCII letters are unchanged.
fn into_ascii_uppercase(self) -> Self; fn into_ascii_uppercase(self) -> Self;
/// Convert the string to ASCII lower case: /// Converts the string to ASCII lower case:
/// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z', /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
/// but non-ASCII letters are unchanged. /// but non-ASCII letters are unchanged.
fn into_ascii_lowercase(self) -> Self; fn into_ascii_lowercase(self) -> Self;
@ -41,7 +41,7 @@ pub trait AsciiExt {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
type Owned; type Owned;
/// Check if within the ASCII range. /// Checks if within the ASCII range.
/// ///
/// # Examples /// # Examples
/// ///
@ -95,7 +95,7 @@ pub trait AsciiExt {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn to_ascii_lowercase(&self) -> Self::Owned; fn to_ascii_lowercase(&self) -> Self::Owned;
/// Check that two strings are an ASCII case-insensitive match. /// Checks that two strings are an ASCII case-insensitive match.
/// ///
/// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`, /// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`,
/// but without allocating and copying temporary strings. /// but without allocating and copying temporary strings.
@ -117,7 +117,7 @@ pub trait AsciiExt {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn eq_ignore_ascii_case(&self, other: &Self) -> bool; fn eq_ignore_ascii_case(&self, other: &Self) -> bool;
/// Convert this type to its ASCII upper case equivalent in-place. /// Converts this type to its ASCII upper case equivalent in-place.
/// ///
/// See `to_ascii_uppercase` for more information. /// See `to_ascii_uppercase` for more information.
/// ///
@ -136,7 +136,7 @@ pub trait AsciiExt {
#[unstable(feature = "ascii")] #[unstable(feature = "ascii")]
fn make_ascii_uppercase(&mut self); fn make_ascii_uppercase(&mut self);
/// Convert this type to its ASCII lower case equivalent in-place. /// Converts this type to its ASCII lower case equivalent in-place.
/// ///
/// See `to_ascii_lowercase` for more information. /// See `to_ascii_lowercase` for more information.
/// ///

View file

@ -506,7 +506,7 @@ impl<K, V, S> HashMap<K, V, S>
} }
impl<K: Hash + Eq, V> HashMap<K, V, RandomState> { impl<K: Hash + Eq, V> HashMap<K, V, RandomState> {
/// Create an empty HashMap. /// Creates an empty HashMap.
/// ///
/// # Examples /// # Examples
/// ///
@ -563,7 +563,7 @@ impl<K, V, S> HashMap<K, V, S>
} }
} }
/// Create an empty HashMap with space for at least `capacity` /// Creates an empty HashMap with space for at least `capacity`
/// elements, using `hasher` to hash the keys. /// elements, using `hasher` to hash the keys.
/// ///
/// Warning: `hasher` is normally randomly generated, and /// Warning: `hasher` is normally randomly generated, and
@ -1596,7 +1596,7 @@ pub struct RandomState {
#[unstable(feature = "std_misc", #[unstable(feature = "std_misc",
reason = "hashing an hash maps may be altered")] reason = "hashing an hash maps may be altered")]
impl RandomState { impl RandomState {
/// Construct a new `RandomState` that is initialized with random keys. /// Constructs a new `RandomState` that is initialized with random keys.
#[inline] #[inline]
#[allow(deprecated)] #[allow(deprecated)]
pub fn new() -> RandomState { pub fn new() -> RandomState {

View file

@ -111,7 +111,7 @@ pub struct HashSet<T, S = RandomState> {
} }
impl<T: Hash + Eq> HashSet<T, RandomState> { impl<T: Hash + Eq> HashSet<T, RandomState> {
/// Create an empty HashSet. /// Creates an empty HashSet.
/// ///
/// # Examples /// # Examples
/// ///
@ -125,7 +125,7 @@ impl<T: Hash + Eq> HashSet<T, RandomState> {
HashSet::with_capacity(INITIAL_CAPACITY) HashSet::with_capacity(INITIAL_CAPACITY)
} }
/// Create an empty HashSet with space for at least `n` elements in /// Creates an empty HashSet with space for at least `n` elements in
/// the hash table. /// the hash table.
/// ///
/// # Examples /// # Examples
@ -166,7 +166,7 @@ impl<T, S> HashSet<T, S>
HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state) HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state)
} }
/// Create an empty HashSet with space for at least `capacity` /// Creates an empty HashSet with space for at least `capacity`
/// elements in the hash table, using `hasher` to hash the keys. /// elements in the hash table, using `hasher` to hash the keys.
/// ///
/// Warning: `hasher` is normally randomly generated, and /// Warning: `hasher` is normally randomly generated, and
@ -402,7 +402,7 @@ impl<T, S> HashSet<T, S>
Union { iter: self.iter().chain(other.difference(self)) } Union { iter: self.iter().chain(other.difference(self)) }
} }
/// Return the number of elements in the set /// Returns the number of elements in the set.
/// ///
/// # Examples /// # Examples
/// ///
@ -417,7 +417,7 @@ impl<T, S> HashSet<T, S>
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize { self.map.len() } pub fn len(&self) -> usize { self.map.len() }
/// Returns true if the set contains no elements /// Returns true if the set contains no elements.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -105,7 +105,7 @@ impl DynamicLibrary {
} }
} }
/// Access the value at the symbol of the dynamic library /// Accesses the value at the symbol of the dynamic library.
pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<*mut T, String> { pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<*mut T, String> {
// This function should have a lifetime constraint of 'a on // This function should have a lifetime constraint of 'a on
// T but that feature is still unimplemented // T but that feature is still unimplemented

View file

@ -261,7 +261,7 @@ pub fn set_var<K: ?Sized, V: ?Sized>(k: &K, v: &V)
os_imp::setenv(k.as_ref(), v.as_ref()) os_imp::setenv(k.as_ref(), v.as_ref())
} }
/// Remove an environment variable from the environment of the currently running process. /// Removes an environment variable from the environment of the currently running process.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -131,7 +131,7 @@ pub struct CStr {
pub struct NulError(usize, Vec<u8>); pub struct NulError(usize, Vec<u8>);
impl CString { impl CString {
/// Create a new C-compatible string from a container of bytes. /// Creates a new C-compatible string from a container of bytes.
/// ///
/// This method will consume the provided data and use the underlying bytes /// This method will consume the provided data and use the underlying bytes
/// to construct a new string, ensuring that there is a trailing 0 byte. /// to construct a new string, ensuring that there is a trailing 0 byte.
@ -167,7 +167,7 @@ impl CString {
} }
} }
/// Create a C-compatible string from a byte vector without checking for /// Creates a C-compatible string from a byte vector without checking for
/// interior 0 bytes. /// interior 0 bytes.
/// ///
/// This method is equivalent to `new` except that no runtime assertion /// This method is equivalent to `new` except that no runtime assertion
@ -245,7 +245,7 @@ impl From<NulError> for io::Error {
} }
impl CStr { impl CStr {
/// Cast a raw C string to a safe C string wrapper. /// Casts a raw C string to a safe C string wrapper.
/// ///
/// This function will cast the provided `ptr` to the `CStr` wrapper which /// This function will cast the provided `ptr` to the `CStr` wrapper which
/// allows inspection and interoperation of non-owned C strings. This method /// allows inspection and interoperation of non-owned C strings. This method
@ -288,7 +288,7 @@ impl CStr {
mem::transmute(slice::from_raw_parts(ptr, len as usize + 1)) mem::transmute(slice::from_raw_parts(ptr, len as usize + 1))
} }
/// Return the inner pointer to this C string. /// Returns the inner pointer to this C string.
/// ///
/// The returned pointer will be valid for as long as `self` is and points /// The returned pointer will be valid for as long as `self` is and points
/// to a contiguous region of memory terminated with a 0 byte to represent /// to a contiguous region of memory terminated with a 0 byte to represent
@ -298,7 +298,7 @@ impl CStr {
self.inner.as_ptr() self.inner.as_ptr()
} }
/// Convert this C string to a byte slice. /// Converts this C string to a byte slice.
/// ///
/// This function will calculate the length of this string (which normally /// This function will calculate the length of this string (which normally
/// requires a linear amount of work to be done) and then return the /// requires a linear amount of work to be done) and then return the
@ -316,7 +316,7 @@ impl CStr {
&bytes[..bytes.len() - 1] &bytes[..bytes.len() - 1]
} }
/// Convert this C string to a byte slice containing the trailing 0 byte. /// Converts this C string to a byte slice containing the trailing 0 byte.
/// ///
/// This function is the equivalent of `to_bytes` except that it will retain /// This function is the equivalent of `to_bytes` except that it will retain
/// the trailing nul instead of chopping it off. /// the trailing nul instead of chopping it off.

View file

@ -25,6 +25,6 @@ mod os_str;
/// Freely convertible to an `&OsStr` slice. /// Freely convertible to an `&OsStr` slice.
#[unstable(feature = "std_misc")] #[unstable(feature = "std_misc")]
pub trait AsOsStr { pub trait AsOsStr {
/// Convert to an `&OsStr` slice. /// Converts to an `&OsStr` slice.
fn as_os_str(&self) -> &OsStr; fn as_os_str(&self) -> &OsStr;
} }

View file

@ -68,7 +68,7 @@ impl OsString {
OsString { inner: Buf::from_string(String::new()) } OsString { inner: Buf::from_string(String::new()) }
} }
/// Construct an `OsString` from a byte sequence. /// Constructs an `OsString` from a byte sequence.
/// ///
/// # Platform behavior /// # Platform behavior
/// ///
@ -93,13 +93,13 @@ impl OsString {
from_bytes_inner(bytes.into()) from_bytes_inner(bytes.into())
} }
/// Convert to an `OsStr` slice. /// Converts to an `OsStr` slice.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_os_str(&self) -> &OsStr { pub fn as_os_str(&self) -> &OsStr {
self self
} }
/// Convert the `OsString` into a `String` if it contains valid Unicode data. /// Converts the `OsString` into a `String` if it contains valid Unicode data.
/// ///
/// On failure, ownership of the original `OsString` is returned. /// On failure, ownership of the original `OsString` is returned.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -107,7 +107,7 @@ impl OsString {
self.inner.into_string().map_err(|buf| OsString { inner: buf} ) self.inner.into_string().map_err(|buf| OsString { inner: buf} )
} }
/// Extend the string with the given `&OsStr` slice. /// Extends the string with the given `&OsStr` slice.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn push<T: AsRef<OsStr>>(&mut self, s: T) { pub fn push<T: AsRef<OsStr>>(&mut self, s: T) {
self.inner.push_slice(&s.as_ref().inner) self.inner.push_slice(&s.as_ref().inner)
@ -220,13 +220,13 @@ impl Hash for OsString {
} }
impl OsStr { impl OsStr {
/// Coerce into an `OsStr` slice. /// Coerces into an `OsStr` slice.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &OsStr { pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &OsStr {
s.as_ref() s.as_ref()
} }
/// Coerce directly from a `&str` slice to a `&OsStr` slice. /// Coerces directly from a `&str` slice to a `&OsStr` slice.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "1.0.0", #[deprecated(since = "1.0.0",
reason = "use `OsStr::new` instead")] reason = "use `OsStr::new` instead")]
@ -234,7 +234,7 @@ impl OsStr {
unsafe { mem::transmute(Slice::from_str(s)) } unsafe { mem::transmute(Slice::from_str(s)) }
} }
/// Yield a `&str` slice if the `OsStr` is valid unicode. /// Yields a `&str` slice if the `OsStr` is valid unicode.
/// ///
/// This conversion may entail doing a check for UTF-8 validity. /// This conversion may entail doing a check for UTF-8 validity.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -242,7 +242,7 @@ impl OsStr {
self.inner.to_str() self.inner.to_str()
} }
/// Convert an `OsStr` to a `Cow<str>`. /// Converts an `OsStr` to a `Cow<str>`.
/// ///
/// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER. /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -250,13 +250,13 @@ impl OsStr {
self.inner.to_string_lossy() self.inner.to_string_lossy()
} }
/// Copy the slice into an owned `OsString`. /// Copies the slice into an owned `OsString`.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn to_os_string(&self) -> OsString { pub fn to_os_string(&self) -> OsString {
OsString { inner: self.inner.to_owned() } OsString { inner: self.inner.to_owned() }
} }
/// Yield this `OsStr` as a byte slice. /// Yields this `OsStr` as a byte slice.
/// ///
/// # Platform behavior /// # Platform behavior
/// ///
@ -274,7 +274,7 @@ impl OsStr {
} }
} }
/// Create a `CString` containing this `OsStr` data. /// Creates a `CString` containing this `OsStr` data.
/// ///
/// Fails if the `OsStr` contains interior nulls. /// Fails if the `OsStr` contains interior nulls.
/// ///
@ -286,7 +286,7 @@ impl OsStr {
self.to_bytes().and_then(|b| CString::new(b).ok()) self.to_bytes().and_then(|b| CString::new(b).ok())
} }
/// Get the underlying byte representation. /// Gets the underlying byte representation.
/// ///
/// Note: it is *crucial* that this API is private, to avoid /// Note: it is *crucial* that this API is private, to avoid
/// revealing the internal, platform-specific encodings. /// revealing the internal, platform-specific encodings.

View file

@ -171,7 +171,7 @@ impl File {
OpenOptions::new().read(true).open(path) OpenOptions::new().read(true).open(path)
} }
/// Open a file in write-only mode. /// Opens a file in write-only mode.
/// ///
/// This function will create a file if it does not exist, /// This function will create a file if it does not exist,
/// and will truncate it if it does. /// and will truncate it if it does.
@ -201,7 +201,7 @@ impl File {
self.path.as_ref().map(|p| &**p) self.path.as_ref().map(|p| &**p)
} }
/// Attempt to sync all OS-internal metadata to disk. /// Attempts to sync all OS-internal metadata to disk.
/// ///
/// This function will attempt to ensure that all in-core data reaches the /// This function will attempt to ensure that all in-core data reaches the
/// filesystem before returning. /// filesystem before returning.
@ -362,7 +362,7 @@ impl OpenOptions {
OpenOptions(fs_imp::OpenOptions::new()) OpenOptions(fs_imp::OpenOptions::new())
} }
/// Set the option for read access. /// Sets the option for read access.
/// ///
/// This option, when true, will indicate that the file should be /// This option, when true, will indicate that the file should be
/// `read`-able if opened. /// `read`-able if opened.
@ -379,7 +379,7 @@ impl OpenOptions {
self.0.read(read); self self.0.read(read); self
} }
/// Set the option for write access. /// Sets the option for write access.
/// ///
/// This option, when true, will indicate that the file should be /// This option, when true, will indicate that the file should be
/// `write`-able if opened. /// `write`-able if opened.
@ -396,7 +396,7 @@ impl OpenOptions {
self.0.write(write); self self.0.write(write); self
} }
/// Set the option for the append mode. /// Sets the option for the append mode.
/// ///
/// This option, when true, means that writes will append to a file instead /// This option, when true, means that writes will append to a file instead
/// of overwriting previous contents. /// of overwriting previous contents.
@ -413,7 +413,7 @@ impl OpenOptions {
self.0.append(append); self self.0.append(append); self
} }
/// Set the option for truncating a previous file. /// Sets the option for truncating a previous file.
/// ///
/// If a file is successfully opened with this option set it will truncate /// If a file is successfully opened with this option set it will truncate
/// the file to 0 length if it already exists. /// the file to 0 length if it already exists.
@ -430,7 +430,7 @@ impl OpenOptions {
self.0.truncate(truncate); self self.0.truncate(truncate); self
} }
/// Set the option for creating a new file. /// Sets the option for creating a new file.
/// ///
/// This option indicates whether a new file will be created if the file /// This option indicates whether a new file will be created if the file
/// does not yet already exist. /// does not yet already exist.
@ -447,7 +447,7 @@ impl OpenOptions {
self.0.create(create); self self.0.create(create); self
} }
/// Open a file at `path` with the options specified by `self`. /// Opens a file at `path` with the options specified by `self`.
/// ///
/// # Errors /// # Errors
/// ///
@ -587,7 +587,7 @@ impl Permissions {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn readonly(&self) -> bool { self.0.readonly() } pub fn readonly(&self) -> bool { self.0.readonly() }
/// Modify the readonly flag for this set of permissions. /// Modifies the readonly flag for this set of permissions.
/// ///
/// This operation does **not** modify the filesystem. To modify the /// This operation does **not** modify the filesystem. To modify the
/// filesystem use the `fs::set_permissions` function. /// filesystem use the `fs::set_permissions` function.
@ -670,7 +670,7 @@ impl DirEntry {
pub fn path(&self) -> PathBuf { self.0.path() } pub fn path(&self) -> PathBuf { self.0.path() }
} }
/// Remove a file from the underlying filesystem. /// Removes a file from the underlying filesystem.
/// ///
/// Note that, just because an unlink call was successful, it is not /// Note that, just because an unlink call was successful, it is not
/// guaranteed that a file is immediately deleted (e.g. depending on /// guaranteed that a file is immediately deleted (e.g. depending on
@ -856,7 +856,7 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
fs_imp::readlink(path.as_ref()) fs_imp::readlink(path.as_ref())
} }
/// Create a new, empty directory at the provided path /// Creates a new, empty directory at the provided path
/// ///
/// # Errors /// # Errors
/// ///
@ -906,7 +906,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
create_dir(path) create_dir(path)
} }
/// Remove an existing, empty directory /// Removes an existing, empty directory.
/// ///
/// # Errors /// # Errors
/// ///
@ -1058,7 +1058,7 @@ impl Iterator for WalkDir {
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")] change and some methods may be removed")]
pub trait PathExt { pub trait PathExt {
/// Get information on the file, directory, etc at this path. /// Gets information on the file, directory, etc at this path.
/// ///
/// Consult the `fs::stat` documentation for more info. /// Consult the `fs::stat` documentation for more info.
/// ///

View file

@ -34,21 +34,21 @@ pub struct Cursor<T> {
} }
impl<T> Cursor<T> { impl<T> Cursor<T> {
/// Create a new cursor wrapping the provided underlying I/O object. /// Creates a new cursor wrapping the provided underlying I/O object.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new(inner: T) -> Cursor<T> { pub fn new(inner: T) -> Cursor<T> {
Cursor { pos: 0, inner: inner } Cursor { pos: 0, inner: inner }
} }
/// Consume this cursor, returning the underlying value. /// Consumes this cursor, returning the underlying value.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_inner(self) -> T { self.inner } pub fn into_inner(self) -> T { self.inner }
/// Get a reference to the underlying value in this cursor. /// Gets a reference to the underlying value in this cursor.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get_ref(&self) -> &T { &self.inner } pub fn get_ref(&self) -> &T { &self.inner }
/// Get a mutable reference to the underlying value in this cursor. /// Gets a mutable reference to the underlying value in this cursor.
/// ///
/// Care should be taken to avoid modifying the internal I/O state of the /// Care should be taken to avoid modifying the internal I/O state of the
/// underlying value as it may corrupt this cursor's position. /// underlying value as it may corrupt this cursor's position.

View file

@ -191,7 +191,7 @@ impl Error {
} }
} }
/// Return the corresponding `ErrorKind` for this error. /// Returns the corresponding `ErrorKind` for this error.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn kind(&self) -> ErrorKind { pub fn kind(&self) -> ErrorKind {
match self.repr { match self.repr {

View file

@ -217,14 +217,14 @@ pub trait Read {
append_to_string(buf, |b| read_to_end(self, b)) append_to_string(buf, |b| read_to_end(self, b))
} }
/// Create a "by reference" adaptor for this instance of `Read`. /// Creates a "by reference" adaptor for this instance of `Read`.
/// ///
/// The returned adaptor also implements `Read` and will simply borrow this /// The returned adaptor also implements `Read` and will simply borrow this
/// current reader. /// current reader.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Transform this `Read` instance to an `Iterator` over its bytes. /// Transforms this `Read` instance to an `Iterator` over its bytes.
/// ///
/// The returned type implements `Iterator` where the `Item` is `Result<u8, /// The returned type implements `Iterator` where the `Item` is `Result<u8,
/// R::Err>`. The yielded item is `Ok` if a byte was successfully read and /// R::Err>`. The yielded item is `Ok` if a byte was successfully read and
@ -235,7 +235,7 @@ pub trait Read {
Bytes { inner: self } Bytes { inner: self }
} }
/// Transform this `Read` instance to an `Iterator` over `char`s. /// Transforms this `Read` instance to an `Iterator` over `char`s.
/// ///
/// This adaptor will attempt to interpret this reader as an UTF-8 encoded /// This adaptor will attempt to interpret this reader as an UTF-8 encoded
/// sequence of characters. The returned iterator will return `None` once /// sequence of characters. The returned iterator will return `None` once
@ -252,7 +252,7 @@ pub trait Read {
Chars { inner: self } Chars { inner: self }
} }
/// Create an adaptor which will chain this stream with another. /// Creates an adaptor which will chain this stream with another.
/// ///
/// The returned `Read` instance will first read all bytes from this object /// The returned `Read` instance will first read all bytes from this object
/// until EOF is encountered. Afterwards the output is equivalent to the /// until EOF is encountered. Afterwards the output is equivalent to the
@ -262,7 +262,7 @@ pub trait Read {
Chain { first: self, second: next, done_first: false } Chain { first: self, second: next, done_first: false }
} }
/// Create an adaptor which will read at most `limit` bytes from it. /// Creates an adaptor which will read at most `limit` bytes from it.
/// ///
/// This function returns a new instance of `Read` which will read at most /// This function returns a new instance of `Read` which will read at most
/// `limit` bytes, after which it will always return EOF (`Ok(0)`). Any /// `limit` bytes, after which it will always return EOF (`Ok(0)`). Any
@ -403,7 +403,7 @@ pub trait Write {
} }
} }
/// Create a "by reference" adaptor for this instance of `Write`. /// Creates a "by reference" adaptor for this instance of `Write`.
/// ///
/// The returned adaptor also implements `Write` and will simply borrow this /// The returned adaptor also implements `Write` and will simply borrow this
/// current writer. /// current writer.

View file

@ -45,7 +45,7 @@ struct StdoutRaw(stdio::Stdout);
/// the `std::io::stdio::stderr_raw` function. /// the `std::io::stdio::stderr_raw` function.
struct StderrRaw(stdio::Stderr); struct StderrRaw(stdio::Stderr);
/// Construct a new raw handle to the standard input of this process. /// Constructs a new raw handle to the standard input of this process.
/// ///
/// The returned handle does not interact with any other handles created nor /// The returned handle does not interact with any other handles created nor
/// handles returned by `std::io::stdin`. Data buffered by the `std::io::stdin` /// handles returned by `std::io::stdin`. Data buffered by the `std::io::stdin`
@ -54,7 +54,7 @@ struct StderrRaw(stdio::Stderr);
/// The returned handle has no external synchronization or buffering. /// The returned handle has no external synchronization or buffering.
fn stdin_raw() -> StdinRaw { StdinRaw(stdio::Stdin::new()) } fn stdin_raw() -> StdinRaw { StdinRaw(stdio::Stdin::new()) }
/// Construct a new raw handle to the standard input stream of this process. /// Constructs a new raw handle to the standard input stream of this process.
/// ///
/// The returned handle does not interact with any other handles created nor /// The returned handle does not interact with any other handles created nor
/// handles returned by `std::io::stdout`. Note that data is buffered by the /// handles returned by `std::io::stdout`. Note that data is buffered by the
@ -65,7 +65,7 @@ fn stdin_raw() -> StdinRaw { StdinRaw(stdio::Stdin::new()) }
/// top. /// top.
fn stdout_raw() -> StdoutRaw { StdoutRaw(stdio::Stdout::new()) } fn stdout_raw() -> StdoutRaw { StdoutRaw(stdio::Stdout::new()) }
/// Construct a new raw handle to the standard input stream of this process. /// Constructs a new raw handle to the standard input stream of this process.
/// ///
/// The returned handle does not interact with any other handles created nor /// The returned handle does not interact with any other handles created nor
/// handles returned by `std::io::stdout`. /// handles returned by `std::io::stdout`.
@ -109,7 +109,7 @@ pub struct StdinLock<'a> {
inner: MutexGuard<'a, BufReader<StdinRaw>>, inner: MutexGuard<'a, BufReader<StdinRaw>>,
} }
/// Create a new handle to the global standard input stream of this process. /// Creates a new handle to the global standard input stream of this process.
/// ///
/// The handle returned refers to a globally shared buffer between all threads. /// The handle returned refers to a globally shared buffer between all threads.
/// Access is synchronized and can be explicitly controlled with the `lock()` /// Access is synchronized and can be explicitly controlled with the `lock()`
@ -139,7 +139,7 @@ pub fn stdin() -> Stdin {
} }
impl Stdin { impl Stdin {
/// Lock this handle to the standard input stream, returning a readable /// Locks this handle to the standard input stream, returning a readable
/// guard. /// guard.
/// ///
/// The lock is released when the returned lock goes out of scope. The /// The lock is released when the returned lock goes out of scope. The
@ -243,7 +243,7 @@ pub fn stdout() -> Stdout {
} }
impl Stdout { impl Stdout {
/// Lock this handle to the standard output stream, returning a writable /// Locks this handle to the standard output stream, returning a writable
/// guard. /// guard.
/// ///
/// The lock is released when the returned lock goes out of scope. The /// The lock is released when the returned lock goes out of scope. The
@ -315,7 +315,7 @@ pub fn stderr() -> Stderr {
} }
impl Stderr { impl Stderr {
/// Lock this handle to the standard error stream, returning a writable /// Locks this handle to the standard error stream, returning a writable
/// guard. /// guard.
/// ///
/// The lock is released when the returned lock goes out of scope. The /// The lock is released when the returned lock goes out of scope. The

View file

@ -58,7 +58,7 @@ pub enum Ipv6MulticastScope {
} }
impl Ipv4Addr { impl Ipv4Addr {
/// Create a new IPv4 address from four eight-bit octets. /// Creates a new IPv4 address from four eight-bit octets.
/// ///
/// The result will represent the IP address a.b.c.d /// The result will represent the IP address a.b.c.d
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -152,7 +152,7 @@ impl Ipv4Addr {
} }
} }
/// Convert this address to an IPv4-compatible IPv6 address /// Converts this address to an IPv4-compatible IPv6 address
/// ///
/// a.b.c.d becomes ::a.b.c.d /// a.b.c.d becomes ::a.b.c.d
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -162,7 +162,7 @@ impl Ipv4Addr {
((self.octets()[2] as u16) << 8) | self.octets()[3] as u16) ((self.octets()[2] as u16) << 8) | self.octets()[3] as u16)
} }
/// Convert this address to an IPv4-mapped IPv6 address /// Converts this address to an IPv4-mapped IPv6 address
/// ///
/// a.b.c.d becomes ::ffff:a.b.c.d /// a.b.c.d becomes ::ffff:a.b.c.d
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -245,7 +245,7 @@ impl FromInner<libc::in_addr> for Ipv4Addr {
} }
impl Ipv6Addr { impl Ipv6Addr {
/// Create a new IPv6 address from eight 16-bit segments. /// Creates a new IPv6 address from eight 16-bit segments.
/// ///
/// The result will represent the IP address a:b:c:d:e:f:g:h /// The result will represent the IP address a:b:c:d:e:f:g:h
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -259,7 +259,7 @@ impl Ipv6Addr {
} }
} }
/// Return the eight 16-bit segments that make up this address /// Returns the eight 16-bit segments that make up this address
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn segments(&self) -> [u16; 8] { pub fn segments(&self) -> [u16; 8] {
[ntoh(self.inner.s6_addr[0]), [ntoh(self.inner.s6_addr[0]),
@ -349,7 +349,7 @@ impl Ipv6Addr {
(self.segments()[0] & 0xff00) == 0xff00 (self.segments()[0] & 0xff00) == 0xff00
} }
/// Convert this address to an IPv4 address. Returns None if this address is /// Converts this address to an IPv4 address. Returns None if this address is
/// neither IPv4-compatible or IPv4-mapped. /// neither IPv4-compatible or IPv4-mapped.
/// ///
/// ::a.b.c.d and ::ffff:a.b.c.d become a.b.c.d /// ::a.b.c.d and ::ffff:a.b.c.d become a.b.c.d

View file

@ -82,7 +82,7 @@ pub struct TcpListener(net_imp::TcpListener);
pub struct Incoming<'a> { listener: &'a TcpListener } pub struct Incoming<'a> { listener: &'a TcpListener }
impl TcpStream { impl TcpStream {
/// Open a TCP connection to a remote host. /// Opens a TCP connection to a remote host.
/// ///
/// `addr` is an address of the remote host. Anything which implements /// `addr` is an address of the remote host. Anything which implements
/// `ToSocketAddrs` trait can be supplied for the address; see this trait /// `ToSocketAddrs` trait can be supplied for the address; see this trait
@ -104,7 +104,7 @@ impl TcpStream {
self.0.socket_addr() self.0.socket_addr()
} }
/// Shut down the read, write, or both halves of this connection. /// Shuts down the read, write, or both halves of this connection.
/// ///
/// This function will cause all pending and future I/O on the specified /// This function will cause all pending and future I/O on the specified
/// portions to return immediately with an appropriate value (see the /// portions to return immediately with an appropriate value (see the
@ -114,7 +114,7 @@ impl TcpStream {
self.0.shutdown(how) self.0.shutdown(how)
} }
/// Create a new independently owned handle to the underlying socket. /// Creates a new independently owned handle to the underlying socket.
/// ///
/// The returned `TcpStream` is a reference to the same stream that this /// The returned `TcpStream` is a reference to the same stream that this
/// object references. Both handles will read and write the same stream of /// object references. Both handles will read and write the same stream of
@ -190,7 +190,7 @@ impl TcpListener {
self.0.socket_addr() self.0.socket_addr()
} }
/// Create a new independently owned handle to the underlying socket. /// Creates a new independently owned handle to the underlying socket.
/// ///
/// The returned `TcpListener` is a reference to the same socket that this /// The returned `TcpListener` is a reference to the same socket that this
/// object references. Both handles can be used to accept incoming /// object references. Both handles can be used to accept incoming

View file

@ -85,7 +85,7 @@ impl UdpSocket {
self.0.socket_addr() self.0.socket_addr()
} }
/// Create a new independently owned handle to the underlying socket. /// Creates a new independently owned handle to the underlying socket.
/// ///
/// The returned `UdpSocket` is a reference to the same socket that this /// The returned `UdpSocket` is a reference to the same socket that this
/// object references. Both handles will read and write the same port, and /// object references. Both handles will read and write the same port, and
@ -100,7 +100,7 @@ impl UdpSocket {
self.0.set_broadcast(on) self.0.set_broadcast(on)
} }
/// Set the multicast loop flag to the specified value /// Sets the multicast loop flag to the specified value
/// ///
/// This lets multicast packets loop back to local sockets (if enabled) /// This lets multicast packets loop back to local sockets (if enabled)
pub fn set_multicast_loop(&self, on: bool) -> io::Result<()> { pub fn set_multicast_loop(&self, on: bool) -> io::Result<()> {

View file

@ -527,7 +527,7 @@ impl f32 {
#[inline] #[inline]
pub fn round(self) -> f32 { num::Float::round(self) } pub fn round(self) -> f32 { num::Float::round(self) }
/// Return the integer part of a number. /// Returns the integer part of a number.
/// ///
/// ``` /// ```
/// let f = 3.3_f32; /// let f = 3.3_f32;
@ -666,7 +666,7 @@ impl f32 {
#[inline] #[inline]
pub fn mul_add(self, a: f32, b: f32) -> f32 { num::Float::mul_add(self, a, b) } pub fn mul_add(self, a: f32, b: f32) -> f32 { num::Float::mul_add(self, a, b) }
/// Take the reciprocal (inverse) of a number, `1/x`. /// Takes the reciprocal (inverse) of a number, `1/x`.
/// ///
/// ``` /// ```
/// use std::f32; /// use std::f32;
@ -680,7 +680,7 @@ impl f32 {
#[inline] #[inline]
pub fn recip(self) -> f32 { num::Float::recip(self) } pub fn recip(self) -> f32 { num::Float::recip(self) }
/// Raise a number to an integer power. /// Raises a number to an integer power.
/// ///
/// Using this function is generally faster than using `powf` /// Using this function is generally faster than using `powf`
/// ///
@ -696,7 +696,7 @@ impl f32 {
#[inline] #[inline]
pub fn powi(self, n: i32) -> f32 { num::Float::powi(self, n) } pub fn powi(self, n: i32) -> f32 { num::Float::powi(self, n) }
/// Raise a number to a floating point power. /// Raises a number to a floating point power.
/// ///
/// ``` /// ```
/// use std::f32; /// use std::f32;
@ -710,7 +710,7 @@ impl f32 {
#[inline] #[inline]
pub fn powf(self, n: f32) -> f32 { num::Float::powf(self, n) } pub fn powf(self, n: f32) -> f32 { num::Float::powf(self, n) }
/// Take the square root of a number. /// Takes the square root of a number.
/// ///
/// Returns NaN if `self` is a negative number. /// Returns NaN if `self` is a negative number.
/// ///
@ -729,7 +729,7 @@ impl f32 {
#[inline] #[inline]
pub fn sqrt(self) -> f32 { num::Float::sqrt(self) } pub fn sqrt(self) -> f32 { num::Float::sqrt(self) }
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
/// ///
/// ``` /// ```
/// # #![feature(std_misc)] /// # #![feature(std_misc)]
@ -852,7 +852,7 @@ impl f32 {
#[inline] #[inline]
pub fn log10(self) -> f32 { num::Float::log10(self) } pub fn log10(self) -> f32 { num::Float::log10(self) }
/// Convert radians to degrees. /// Converts radians to degrees.
/// ///
/// ``` /// ```
/// # #![feature(std_misc)] /// # #![feature(std_misc)]
@ -868,7 +868,7 @@ impl f32 {
#[inline] #[inline]
pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) } pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) }
/// Convert degrees to radians. /// Converts degrees to radians.
/// ///
/// ``` /// ```
/// # #![feature(std_misc)] /// # #![feature(std_misc)]
@ -1003,7 +1003,7 @@ impl f32 {
unsafe { cmath::fdimf(self, other) } unsafe { cmath::fdimf(self, other) }
} }
/// Take the cubic root of a number. /// Takes the cubic root of a number.
/// ///
/// ``` /// ```
/// use std::f32; /// use std::f32;
@ -1021,7 +1021,7 @@ impl f32 {
unsafe { cmath::cbrtf(self) } unsafe { cmath::cbrtf(self) }
} }
/// Calculate the length of the hypotenuse of a right-angle triangle given /// Calculates the length of the hypotenuse of a right-angle triangle given
/// legs of length `x` and `y`. /// legs of length `x` and `y`.
/// ///
/// ``` /// ```

View file

@ -534,7 +534,7 @@ impl f64 {
#[inline] #[inline]
pub fn round(self) -> f64 { num::Float::round(self) } pub fn round(self) -> f64 { num::Float::round(self) }
/// Return the integer part of a number. /// Returns the integer part of a number.
/// ///
/// ``` /// ```
/// let f = 3.3_f64; /// let f = 3.3_f64;
@ -671,7 +671,7 @@ impl f64 {
#[inline] #[inline]
pub fn mul_add(self, a: f64, b: f64) -> f64 { num::Float::mul_add(self, a, b) } pub fn mul_add(self, a: f64, b: f64) -> f64 { num::Float::mul_add(self, a, b) }
/// Take the reciprocal (inverse) of a number, `1/x`. /// Takes the reciprocal (inverse) of a number, `1/x`.
/// ///
/// ``` /// ```
/// let x = 2.0_f64; /// let x = 2.0_f64;
@ -683,7 +683,7 @@ impl f64 {
#[inline] #[inline]
pub fn recip(self) -> f64 { num::Float::recip(self) } pub fn recip(self) -> f64 { num::Float::recip(self) }
/// Raise a number to an integer power. /// Raises a number to an integer power.
/// ///
/// Using this function is generally faster than using `powf` /// Using this function is generally faster than using `powf`
/// ///
@ -697,7 +697,7 @@ impl f64 {
#[inline] #[inline]
pub fn powi(self, n: i32) -> f64 { num::Float::powi(self, n) } pub fn powi(self, n: i32) -> f64 { num::Float::powi(self, n) }
/// Raise a number to a floating point power. /// Raises a number to a floating point power.
/// ///
/// ``` /// ```
/// let x = 2.0_f64; /// let x = 2.0_f64;
@ -709,7 +709,7 @@ impl f64 {
#[inline] #[inline]
pub fn powf(self, n: f64) -> f64 { num::Float::powf(self, n) } pub fn powf(self, n: f64) -> f64 { num::Float::powf(self, n) }
/// Take the square root of a number. /// Takes the square root of a number.
/// ///
/// Returns NaN if `self` is a negative number. /// Returns NaN if `self` is a negative number.
/// ///
@ -726,7 +726,7 @@ impl f64 {
#[inline] #[inline]
pub fn sqrt(self) -> f64 { num::Float::sqrt(self) } pub fn sqrt(self) -> f64 { num::Float::sqrt(self) }
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
/// ///
/// ``` /// ```
/// # #![feature(std_misc)] /// # #![feature(std_misc)]
@ -835,7 +835,7 @@ impl f64 {
#[inline] #[inline]
pub fn log10(self) -> f64 { num::Float::log10(self) } pub fn log10(self) -> f64 { num::Float::log10(self) }
/// Convert radians to degrees. /// Converts radians to degrees.
/// ///
/// ``` /// ```
/// use std::f64::consts; /// use std::f64::consts;
@ -850,7 +850,7 @@ impl f64 {
#[inline] #[inline]
pub fn to_degrees(self) -> f64 { num::Float::to_degrees(self) } pub fn to_degrees(self) -> f64 { num::Float::to_degrees(self) }
/// Convert degrees to radians. /// Converts degrees to radians.
/// ///
/// ``` /// ```
/// use std::f64::consts; /// use std::f64::consts;
@ -978,7 +978,7 @@ impl f64 {
unsafe { cmath::fdim(self, other) } unsafe { cmath::fdim(self, other) }
} }
/// Take the cubic root of a number. /// Takes the cubic root of a number.
/// ///
/// ``` /// ```
/// let x = 8.0_f64; /// let x = 8.0_f64;
@ -994,7 +994,7 @@ impl f64 {
unsafe { cmath::cbrt(self) } unsafe { cmath::cbrt(self) }
} }
/// Calculate the length of the hypotenuse of a right-angle triangle given /// Calculates the length of the hypotenuse of a right-angle triangle given
/// legs of length `x` and `y`. /// legs of length `x` and `y`.
/// ///
/// ``` /// ```

View file

@ -383,7 +383,7 @@ pub trait Float
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn round(self) -> Self; fn round(self) -> Self;
/// Return the integer part of a number. /// Returns the integer part of a number.
/// ///
/// ``` /// ```
/// use std::num::Float; /// use std::num::Float;
@ -509,7 +509,7 @@ pub trait Float
#[unstable(feature = "std_misc", #[unstable(feature = "std_misc",
reason = "unsure about its place in the world")] reason = "unsure about its place in the world")]
fn mul_add(self, a: Self, b: Self) -> Self; fn mul_add(self, a: Self, b: Self) -> Self;
/// Take the reciprocal (inverse) of a number, `1/x`. /// Takes the reciprocal (inverse) of a number, `1/x`.
/// ///
/// ``` /// ```
/// # #![feature(std_misc)] /// # #![feature(std_misc)]
@ -524,7 +524,7 @@ pub trait Float
reason = "unsure about its place in the world")] reason = "unsure about its place in the world")]
fn recip(self) -> Self; fn recip(self) -> Self;
/// Raise a number to an integer power. /// Raises a number to an integer power.
/// ///
/// Using this function is generally faster than using `powf` /// Using this function is generally faster than using `powf`
/// ///
@ -538,7 +538,7 @@ pub trait Float
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn powi(self, n: i32) -> Self; fn powi(self, n: i32) -> Self;
/// Raise a number to a floating point power. /// Raises a number to a floating point power.
/// ///
/// ``` /// ```
/// use std::num::Float; /// use std::num::Float;
@ -550,7 +550,7 @@ pub trait Float
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn powf(self, n: Self) -> Self; fn powf(self, n: Self) -> Self;
/// Take the square root of a number. /// Takes the square root of a number.
/// ///
/// Returns NaN if `self` is a negative number. /// Returns NaN if `self` is a negative number.
/// ///
@ -569,7 +569,7 @@ pub trait Float
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn sqrt(self) -> Self; fn sqrt(self) -> Self;
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
/// ///
/// ``` /// ```
/// # #![feature(std_misc)] /// # #![feature(std_misc)]
@ -679,7 +679,7 @@ pub trait Float
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn log10(self) -> Self; fn log10(self) -> Self;
/// Convert radians to degrees. /// Converts radians to degrees.
/// ///
/// ``` /// ```
/// use std::num::Float; /// use std::num::Float;
@ -693,7 +693,7 @@ pub trait Float
/// ``` /// ```
#[unstable(feature = "std_misc", reason = "desirability is unclear")] #[unstable(feature = "std_misc", reason = "desirability is unclear")]
fn to_degrees(self) -> Self; fn to_degrees(self) -> Self;
/// Convert degrees to radians. /// Converts degrees to radians.
/// ///
/// ``` /// ```
/// # #![feature(std_misc)] /// # #![feature(std_misc)]
@ -807,7 +807,7 @@ pub trait Float
/// ``` /// ```
#[unstable(feature = "std_misc", reason = "may be renamed")] #[unstable(feature = "std_misc", reason = "may be renamed")]
fn abs_sub(self, other: Self) -> Self; fn abs_sub(self, other: Self) -> Self;
/// Take the cubic root of a number. /// Takes the cubic root of a number.
/// ///
/// ``` /// ```
/// # #![feature(std_misc)] /// # #![feature(std_misc)]
@ -822,7 +822,7 @@ pub trait Float
/// ``` /// ```
#[unstable(feature = "std_misc", reason = "may be renamed")] #[unstable(feature = "std_misc", reason = "may be renamed")]
fn cbrt(self) -> Self; fn cbrt(self) -> Self;
/// Calculate the length of the hypotenuse of a right-angle triangle given /// Calculates the length of the hypotenuse of a right-angle triangle given
/// legs of length `x` and `y`. /// legs of length `x` and `y`.
/// ///
/// ``` /// ```

View file

@ -312,7 +312,7 @@ impl<'a> Prefix<'a> {
} }
/// Determine if the prefix is verbatim, i.e. begins `\\?\`. /// Determines if the prefix is verbatim, i.e. begins `\\?\`.
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn is_verbatim(&self) -> bool { pub fn is_verbatim(&self) -> bool {
@ -341,7 +341,7 @@ impl<'a> Prefix<'a> {
// Exposed parsing helpers // Exposed parsing helpers
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// Determine whether the character is one of the permitted path /// Determines whether the character is one of the permitted path
/// separators for the current platform. /// separators for the current platform.
/// ///
/// # Examples /// # Examples
@ -524,7 +524,7 @@ pub enum Component<'a> {
} }
impl<'a> Component<'a> { impl<'a> Component<'a> {
/// Extract the underlying `OsStr` slice /// Extracts the underlying `OsStr` slice
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_os_str(self) -> &'a OsStr { pub fn as_os_str(self) -> &'a OsStr {
match self { match self {
@ -629,7 +629,7 @@ impl<'a> Components<'a> {
} }
} }
/// Extract a slice corresponding to the portion of the path remaining for iteration. /// Extracts a slice corresponding to the portion of the path remaining for iteration.
/// ///
/// # Examples /// # Examples
/// ///
@ -750,7 +750,7 @@ impl<'a> AsRef<OsStr> for Components<'a> {
} }
impl<'a> Iter<'a> { impl<'a> Iter<'a> {
/// Extract a slice corresponding to the portion of the path remaining for iteration. /// Extracts a slice corresponding to the portion of the path remaining for iteration.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_path(&self) -> &'a Path { pub fn as_path(&self) -> &'a Path {
self.inner.as_path() self.inner.as_path()
@ -941,19 +941,19 @@ impl PathBuf {
unsafe { mem::transmute(self) } unsafe { mem::transmute(self) }
} }
/// Allocate an empty `PathBuf`. /// Allocates an empty `PathBuf`.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> PathBuf { pub fn new() -> PathBuf {
PathBuf { inner: OsString::new() } PathBuf { inner: OsString::new() }
} }
/// Coerce to a `Path` slice. /// Coerces to a `Path` slice.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn as_path(&self) -> &Path { pub fn as_path(&self) -> &Path {
self self
} }
/// Extend `self` with `path`. /// Extends `self` with `path`.
/// ///
/// If `path` is absolute, it replaces the current path. /// If `path` is absolute, it replaces the current path.
/// ///
@ -1064,7 +1064,7 @@ impl PathBuf {
true true
} }
/// Consume the `PathBuf`, yielding its internal `OsString` storage /// Consumes the `PathBuf`, yielding its internal `OsString` storage.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn into_os_string(self) -> OsString { pub fn into_os_string(self) -> OsString {
self.inner self.inner
@ -1254,7 +1254,7 @@ impl Path {
unsafe { mem::transmute(s.as_ref()) } unsafe { mem::transmute(s.as_ref()) }
} }
/// Yield the underlying `OsStr` slice. /// Yields the underlying `OsStr` slice.
/// ///
/// # Examples /// # Examples
/// ///
@ -1268,7 +1268,7 @@ impl Path {
&self.inner &self.inner
} }
/// Yield a `&str` slice if the `Path` is valid unicode. /// Yields a `&str` slice if the `Path` is valid unicode.
/// ///
/// This conversion may entail doing a check for UTF-8 validity. /// This conversion may entail doing a check for UTF-8 validity.
/// ///
@ -1284,7 +1284,7 @@ impl Path {
self.inner.to_str() self.inner.to_str()
} }
/// Convert a `Path` to a `Cow<str>`. /// Converts a `Path` to a `Cow<str>`.
/// ///
/// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER. /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
/// ///
@ -1300,7 +1300,7 @@ impl Path {
self.inner.to_string_lossy() self.inner.to_string_lossy()
} }
/// Convert a `Path` to an owned `PathBuf`. /// Converts a `Path` to an owned `PathBuf`.
/// ///
/// # Examples /// # Examples
/// ///
@ -1477,7 +1477,7 @@ impl Path {
iter_after(self.components().rev(), child.as_ref().components().rev()).is_some() iter_after(self.components().rev(), child.as_ref().components().rev()).is_some()
} }
/// Extract the stem (non-extension) portion of `self.file()`. /// Extracts the stem (non-extension) portion of `self.file()`.
/// ///
/// The stem is: /// The stem is:
/// ///
@ -1500,7 +1500,7 @@ impl Path {
self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after)) self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after))
} }
/// Extract the extension of `self.file()`, if possible. /// Extracts the extension of `self.file()`, if possible.
/// ///
/// The extension is: /// The extension is:
/// ///
@ -1715,7 +1715,7 @@ impl cmp::Ord for Path {
#[unstable(feature = "std_misc")] #[unstable(feature = "std_misc")]
#[deprecated(since = "1.0.0", reason = "use std::convert::AsRef<Path> instead")] #[deprecated(since = "1.0.0", reason = "use std::convert::AsRef<Path> instead")]
pub trait AsPath { pub trait AsPath {
/// Convert to a `Path`. /// Converts to a `Path`.
#[unstable(feature = "std_misc")] #[unstable(feature = "std_misc")]
fn as_path(&self) -> &Path; fn as_path(&self) -> &Path;
} }

View file

@ -194,7 +194,7 @@ impl Command {
self self
} }
/// Set the working directory for the child process. /// Sets the working directory for the child process.
#[stable(feature = "process", since = "1.0.0")] #[stable(feature = "process", since = "1.0.0")]
pub fn current_dir<P: AsRef<path::Path>>(&mut self, dir: P) -> &mut Command { pub fn current_dir<P: AsRef<path::Path>>(&mut self, dir: P) -> &mut Command {
self.inner.cwd(dir.as_ref().as_ref()); self.inner.cwd(dir.as_ref().as_ref());
@ -396,7 +396,7 @@ impl ExitStatus {
self.0.success() self.0.success()
} }
/// Return the exit code of the process, if any. /// Returns the exit code of the process, if any.
/// ///
/// On Unix, this will return `None` if the process was terminated /// On Unix, this will return `None` if the process was terminated
/// by a signal; `std::os::unix` provides an extension trait for /// by a signal; `std::os::unix` provides an extension trait for
@ -453,7 +453,7 @@ impl Child {
unsafe { self.handle.kill() } unsafe { self.handle.kill() }
} }
/// Wait for the child to exit completely, returning the status that it /// Waits for the child to exit completely, returning the status that it
/// exited with. This function will continue to have the same return value /// exited with. This function will continue to have the same return value
/// after it has been called at least once. /// after it has been called at least once.
/// ///
@ -474,7 +474,7 @@ impl Child {
} }
} }
/// Simultaneously wait for the child to exit and collect all remaining /// Simultaneously waits for the child to exit and collect all remaining
/// output on the stdout/stderr handles, returning a `Output` /// output on the stdout/stderr handles, returning a `Output`
/// instance. /// instance.
/// ///

View file

@ -49,7 +49,7 @@ struct BarrierState {
pub struct BarrierWaitResult(bool); pub struct BarrierWaitResult(bool);
impl Barrier { impl Barrier {
/// Create a new barrier that can block a given number of threads. /// Creates a new barrier that can block a given number of threads.
/// ///
/// A barrier will block `n`-1 threads which call `wait` and then wake up /// A barrier will block `n`-1 threads which call `wait` and then wake up
/// all threads at once when the `n`th thread calls `wait`. /// all threads at once when the `n`th thread calls `wait`.
@ -65,7 +65,7 @@ impl Barrier {
} }
} }
/// Block the current thread until all threads has rendezvoused here. /// Blocks the current thread until all threads has rendezvoused here.
/// ///
/// Barriers are re-usable after all threads have rendezvoused once, and can /// Barriers are re-usable after all threads have rendezvoused once, and can
/// be used continuously. /// be used continuously.
@ -97,7 +97,7 @@ impl Barrier {
} }
impl BarrierWaitResult { impl BarrierWaitResult {
/// Return whether this thread from `wait` is the "leader thread". /// Returns whether this thread from `wait` is the "leader thread".
/// ///
/// Only one thread will have `true` returned from their result, all other /// Only one thread will have `true` returned from their result, all other
/// threads will have `false` returned. /// threads will have `false` returned.

View file

@ -102,7 +102,7 @@ impl Condvar {
} }
} }
/// Block the current thread until this condition variable receives a /// Blocks the current thread until this condition variable receives a
/// notification. /// notification.
/// ///
/// This function will atomically unlock the mutex specified (represented by /// This function will atomically unlock the mutex specified (represented by
@ -137,7 +137,7 @@ impl Condvar {
} }
} }
/// Wait on this condition variable for a notification, timing out after a /// Waits on this condition variable for a notification, timing out after a
/// specified duration. /// specified duration.
/// ///
/// The semantics of this function are equivalent to `wait()` /// The semantics of this function are equivalent to `wait()`
@ -169,7 +169,7 @@ impl Condvar {
self.wait_timeout_ms(guard, dur.num_milliseconds() as u32) self.wait_timeout_ms(guard, dur.num_milliseconds() as u32)
} }
/// Wait on this condition variable for a notification, timing out after a /// Waits on this condition variable for a notification, timing out after a
/// specified duration. /// specified duration.
/// ///
/// The semantics of this function are equivalent to `wait_timeout` except /// The semantics of this function are equivalent to `wait_timeout` except
@ -189,7 +189,7 @@ impl Condvar {
} }
} }
/// Wake up one blocked thread on this condvar. /// Wakes up one blocked thread on this condvar.
/// ///
/// If there is a blocked thread on this condition variable, then it will /// If there is a blocked thread on this condition variable, then it will
/// be woken up from its call to `wait` or `wait_timeout`. Calls to /// be woken up from its call to `wait` or `wait_timeout`. Calls to
@ -199,7 +199,7 @@ impl Condvar {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn notify_one(&self) { unsafe { self.inner.inner.notify_one() } } pub fn notify_one(&self) { unsafe { self.inner.inner.notify_one() } }
/// Wake up all blocked threads on this condvar. /// Wakes up all blocked threads on this condvar.
/// ///
/// This method will ensure that any current waiters on the condition /// This method will ensure that any current waiters on the condition
/// variable are awoken. Calls to `notify_all()` are not buffered in any /// variable are awoken. Calls to `notify_all()` are not buffered in any
@ -218,7 +218,7 @@ impl Drop for Condvar {
} }
impl StaticCondvar { impl StaticCondvar {
/// Block the current thread until this condition variable receives a /// Blocks the current thread until this condition variable receives a
/// notification. /// notification.
/// ///
/// See `Condvar::wait`. /// See `Condvar::wait`.
@ -239,7 +239,7 @@ impl StaticCondvar {
} }
} }
/// Wait on this condition variable for a notification, timing out after a /// Waits on this condition variable for a notification, timing out after a
/// specified duration. /// specified duration.
/// ///
/// See `Condvar::wait_timeout`. /// See `Condvar::wait_timeout`.
@ -260,7 +260,7 @@ impl StaticCondvar {
} }
} }
/// Wait on this condition variable for a notification, timing out after a /// Waits on this condition variable for a notification, timing out after a
/// specified duration. /// specified duration.
/// ///
/// The implementation will repeatedly wait while the duration has not /// The implementation will repeatedly wait while the duration has not
@ -306,21 +306,21 @@ impl StaticCondvar {
poison::map_result(guard_result, |g| (g, true)) poison::map_result(guard_result, |g| (g, true))
} }
/// Wake up one blocked thread on this condvar. /// Wakes up one blocked thread on this condvar.
/// ///
/// See `Condvar::notify_one`. /// See `Condvar::notify_one`.
#[unstable(feature = "std_misc", #[unstable(feature = "std_misc",
reason = "may be merged with Condvar in the future")] reason = "may be merged with Condvar in the future")]
pub fn notify_one(&'static self) { unsafe { self.inner.notify_one() } } pub fn notify_one(&'static self) { unsafe { self.inner.notify_one() } }
/// Wake 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 = "std_misc", #[unstable(feature = "std_misc",
reason = "may be merged with Condvar in the future")] reason = "may be merged with Condvar in the future")]
pub fn notify_all(&'static self) { unsafe { self.inner.notify_all() } } pub fn notify_all(&'static self) { unsafe { self.inner.notify_all() } }
/// Deallocate all resources associated with this static condvar. /// Deallocates all resources associated with this static condvar.
/// ///
/// This method is unsafe to call as there is no guarantee that there are no /// This method is unsafe to call as there is no guarantee that there are no
/// active users of the condvar, and this also doesn't prevent any future /// active users of the condvar, and this also doesn't prevent any future

View file

@ -750,7 +750,7 @@ impl<T> Receiver<T> {
} }
} }
/// Attempt to wait for a value on this receiver, returning an error if the /// Attempts to wait for a value on this receiver, returning an error if the
/// corresponding channel has hung up. /// corresponding channel has hung up.
/// ///
/// This function will always block the current thread if there is no data /// This function will always block the current thread if there is no data

View file

@ -254,11 +254,11 @@ impl Select {
} }
impl<'rx, T: Send> Handle<'rx, T> { impl<'rx, T: Send> Handle<'rx, T> {
/// Retrieve the id of this handle. /// Retrieves the id of this handle.
#[inline] #[inline]
pub fn id(&self) -> usize { self.id } pub fn id(&self) -> usize { self.id }
/// Block to receive a value on the underlying receiver, returning `Some` on /// Blocks to receive a value on the underlying receiver, returning `Some` on
/// success or `None` if the channel disconnects. This function has the same /// success or `None` if the channel disconnects. This function has the same
/// semantics as `Receiver.recv` /// semantics as `Receiver.recv`
pub fn recv(&mut self) -> Result<T, RecvError> { self.rx.recv() } pub fn recv(&mut self) -> Result<T, RecvError> { self.rx.recv() }

View file

@ -232,7 +232,7 @@ impl<T> Mutex<T> {
} }
} }
/// Determine whether the lock is poisoned. /// Determines whether the lock is poisoned.
/// ///
/// If another thread is active, the lock can still become poisoned at any /// If another thread is active, the lock can still become poisoned at any
/// time. You should not trust a `false` value for program correctness /// time. You should not trust a `false` value for program correctness

View file

@ -51,7 +51,7 @@ pub const ONCE_INIT: Once = Once {
}; };
impl Once { impl Once {
/// Perform an initialization routine once and only once. The given closure /// Performs an initialization routine once and only once. The given closure
/// will be executed if this is the first time `call_once` has been called, /// will be executed if this is the first time `call_once` has been called,
/// and otherwise the routine will *not* be invoked. /// and otherwise the routine will *not* be invoked.
/// ///

View file

@ -169,7 +169,7 @@ impl<T> RwLock<T> {
RwLockReadGuard::new(&*self.inner, &self.data) RwLockReadGuard::new(&*self.inner, &self.data)
} }
/// Attempt to acquire this lock with shared read access. /// Attempts to acquire this lock with shared read access.
/// ///
/// This function will never block and will return immediately if `read` /// This function will never block and will return immediately if `read`
/// would otherwise succeed. Returns `Some` of an RAII guard which will /// would otherwise succeed. Returns `Some` of an RAII guard which will
@ -194,7 +194,7 @@ impl<T> RwLock<T> {
} }
} }
/// Lock this rwlock with exclusive write access, blocking the current /// Locks this rwlock with exclusive write access, blocking the current
/// thread until it can be acquired. /// thread until it can be acquired.
/// ///
/// This function will not return while other writers or other readers /// This function will not return while other writers or other readers
@ -215,7 +215,7 @@ impl<T> RwLock<T> {
RwLockWriteGuard::new(&*self.inner, &self.data) RwLockWriteGuard::new(&*self.inner, &self.data)
} }
/// Attempt to lock this rwlock with exclusive write access. /// Attempts to lock this rwlock with exclusive write access.
/// ///
/// This function does not ever block, and it will return `None` if a call /// This function does not ever block, and it will return `None` if a call
/// to `write` would otherwise block. If successful, an RAII guard is /// to `write` would otherwise block. If successful, an RAII guard is
@ -237,7 +237,7 @@ impl<T> RwLock<T> {
} }
} }
/// Determine whether the lock is poisoned. /// Determines whether the lock is poisoned.
/// ///
/// If another thread is active, the lock can still become poisoned at any /// If another thread is active, the lock can still become poisoned at any
/// time. You should not trust a `false` value for program correctness /// time. You should not trust a `false` value for program correctness
@ -287,7 +287,7 @@ impl StaticRwLock {
RwLockReadGuard::new(self, &DUMMY.0) RwLockReadGuard::new(self, &DUMMY.0)
} }
/// Attempt to acquire this lock with shared read access. /// Attempts to acquire this lock with shared read access.
/// ///
/// See `RwLock::try_read`. /// See `RwLock::try_read`.
#[inline] #[inline]
@ -302,7 +302,7 @@ impl StaticRwLock {
} }
} }
/// Lock this rwlock with exclusive write access, blocking the current /// Locks this rwlock with exclusive write access, blocking the current
/// thread until it can be acquired. /// thread until it can be acquired.
/// ///
/// See `RwLock::write`. /// See `RwLock::write`.
@ -314,7 +314,7 @@ impl StaticRwLock {
RwLockWriteGuard::new(self, &DUMMY.0) RwLockWriteGuard::new(self, &DUMMY.0)
} }
/// Attempt to lock this rwlock with exclusive write access. /// Attempts to lock this rwlock with exclusive write access.
/// ///
/// See `RwLock::try_write`. /// See `RwLock::try_write`.
#[inline] #[inline]
@ -329,7 +329,7 @@ impl StaticRwLock {
} }
} }
/// Deallocate all resources associated with this static lock. /// Deallocates all resources associated with this static lock.
/// ///
/// This method is unsafe to call as there is no guarantee that there are no /// This method is unsafe to call as there is no guarantee that there are no
/// active users of the lock, and this also doesn't prevent any future users /// active users of the lock, and this also doesn't prevent any future users

View file

@ -31,15 +31,15 @@ impl Condvar {
#[inline] #[inline]
pub unsafe fn new() -> Condvar { Condvar(imp::Condvar::new()) } pub unsafe fn new() -> Condvar { Condvar(imp::Condvar::new()) }
/// Signal one waiter on this condition variable to wake up. /// Signals one waiter on this condition variable to wake up.
#[inline] #[inline]
pub unsafe fn notify_one(&self) { self.0.notify_one() } pub unsafe fn notify_one(&self) { self.0.notify_one() }
/// Awaken all current waiters on this condition variable. /// Awakens all current waiters on this condition variable.
#[inline] #[inline]
pub unsafe fn notify_all(&self) { self.0.notify_all() } pub unsafe fn notify_all(&self) { self.0.notify_all() }
/// Wait for a signal on the specified mutex. /// Waits for a signal on the specified mutex.
/// ///
/// Behavior is undefined if the mutex is not locked by the current thread. /// Behavior is undefined if the mutex is not locked by the current thread.
/// Behavior is also undefined if more than one mutex is used concurrently /// Behavior is also undefined if more than one mutex is used concurrently
@ -47,7 +47,7 @@ impl Condvar {
#[inline] #[inline]
pub unsafe fn wait(&self, mutex: &Mutex) { self.0.wait(mutex::raw(mutex)) } pub unsafe fn wait(&self, mutex: &Mutex) { self.0.wait(mutex::raw(mutex)) }
/// Wait for a signal on the specified mutex with a timeout duration /// Waits for a signal on the specified mutex with a timeout duration
/// specified by `dur` (a relative time into the future). /// specified by `dur` (a relative time into the future).
/// ///
/// Behavior is undefined if the mutex is not locked by the current thread. /// Behavior is undefined if the mutex is not locked by the current thread.
@ -58,7 +58,7 @@ impl Condvar {
self.0.wait_timeout(mutex::raw(mutex), dur) self.0.wait_timeout(mutex::raw(mutex), dur)
} }
/// Deallocate all resources associated with this condition variable. /// Deallocates all resources associated with this condition variable.
/// ///
/// Behavior is undefined if there are current or will be future users of /// Behavior is undefined if there are current or will be future users of
/// this condition variable. /// this condition variable.

View file

@ -24,14 +24,14 @@ unsafe impl Sync for Mutex {}
pub const MUTEX_INIT: Mutex = Mutex(imp::MUTEX_INIT); pub const MUTEX_INIT: Mutex = Mutex(imp::MUTEX_INIT);
impl Mutex { impl Mutex {
/// Lock the mutex blocking the current thread until it is available. /// Locks the mutex blocking the current thread until it is available.
/// ///
/// Behavior is undefined if the mutex has been moved between this and any /// Behavior is undefined if the mutex has been moved between this and any
/// previous function call. /// previous function call.
#[inline] #[inline]
pub unsafe fn lock(&self) { self.0.lock() } pub unsafe fn lock(&self) { self.0.lock() }
/// Attempt to lock the mutex without blocking, returning whether it was /// Attempts to lock the mutex without blocking, returning whether it was
/// successfully acquired or not. /// successfully acquired or not.
/// ///
/// Behavior is undefined if the mutex has been moved between this and any /// Behavior is undefined if the mutex has been moved between this and any
@ -39,14 +39,14 @@ impl Mutex {
#[inline] #[inline]
pub unsafe fn try_lock(&self) -> bool { self.0.try_lock() } pub unsafe fn try_lock(&self) -> bool { self.0.try_lock() }
/// Unlock the mutex. /// Unlocks the mutex.
/// ///
/// Behavior is undefined if the current thread does not actually hold the /// Behavior is undefined if the current thread does not actually hold the
/// mutex. /// mutex.
#[inline] #[inline]
pub unsafe fn unlock(&self) { self.0.unlock() } pub unsafe fn unlock(&self) { self.0.unlock() }
/// Deallocate all resources associated with this mutex. /// Deallocates all resources associated with this mutex.
/// ///
/// Behavior is undefined if there are current or will be future users of /// Behavior is undefined if there are current or will be future users of
/// this mutex. /// this mutex.

View file

@ -116,7 +116,7 @@ impl<T: Send> Error for PoisonError<T> {
} }
impl<T> PoisonError<T> { impl<T> PoisonError<T> {
/// Create a `PoisonError`. /// Creates a `PoisonError`.
#[unstable(feature = "std_misc")] #[unstable(feature = "std_misc")]
pub fn new(guard: T) -> PoisonError<T> { pub fn new(guard: T) -> PoisonError<T> {
PoisonError { guard: guard } PoisonError { guard: guard }

View file

@ -21,7 +21,7 @@ pub struct RWLock(imp::RWLock);
pub const RWLOCK_INIT: RWLock = RWLock(imp::RWLOCK_INIT); pub const RWLOCK_INIT: RWLock = RWLock(imp::RWLOCK_INIT);
impl RWLock { impl RWLock {
/// Acquire shared access to the underlying lock, blocking the current /// Acquires shared access to the underlying lock, blocking the current
/// thread to do so. /// thread to do so.
/// ///
/// Behavior is undefined if the rwlock has been moved between this and any /// Behavior is undefined if the rwlock has been moved between this and any
@ -29,7 +29,7 @@ impl RWLock {
#[inline] #[inline]
pub unsafe fn read(&self) { self.0.read() } pub unsafe fn read(&self) { self.0.read() }
/// Attempt to acquire shared access to this lock, returning whether it /// Attempts to acquire shared access to this lock, returning whether it
/// succeeded or not. /// succeeded or not.
/// ///
/// This function does not block the current thread. /// This function does not block the current thread.
@ -39,7 +39,7 @@ impl RWLock {
#[inline] #[inline]
pub unsafe fn try_read(&self) -> bool { self.0.try_read() } pub unsafe fn try_read(&self) -> bool { self.0.try_read() }
/// Acquire write access to the underlying lock, blocking the current thread /// Acquires write access to the underlying lock, blocking the current thread
/// to do so. /// to do so.
/// ///
/// Behavior is undefined if the rwlock has been moved between this and any /// Behavior is undefined if the rwlock has been moved between this and any
@ -47,7 +47,7 @@ impl RWLock {
#[inline] #[inline]
pub unsafe fn write(&self) { self.0.write() } pub unsafe fn write(&self) { self.0.write() }
/// Attempt to acquire exclusive access to this lock, returning whether it /// Attempts to acquire exclusive access to this lock, returning whether it
/// succeeded or not. /// succeeded or not.
/// ///
/// This function does not block the current thread. /// This function does not block the current thread.
@ -57,20 +57,20 @@ impl RWLock {
#[inline] #[inline]
pub unsafe fn try_write(&self) -> bool { self.0.try_write() } pub unsafe fn try_write(&self) -> bool { self.0.try_write() }
/// Unlock previously acquired shared access to this lock. /// Unlocks previously acquired shared access to this lock.
/// ///
/// Behavior is undefined if the current thread does not have shared access. /// Behavior is undefined if the current thread does not have shared access.
#[inline] #[inline]
pub unsafe fn read_unlock(&self) { self.0.read_unlock() } pub unsafe fn read_unlock(&self) { self.0.read_unlock() }
/// Unlock previously acquired exclusive access to this lock. /// Unlocks previously acquired exclusive access to this lock.
/// ///
/// Behavior is undefined if the current thread does not currently have /// Behavior is undefined if the current thread does not currently have
/// exclusive access. /// exclusive access.
#[inline] #[inline]
pub unsafe fn write_unlock(&self) { self.0.write_unlock() } pub unsafe fn write_unlock(&self) { self.0.write_unlock() }
/// Destroy OS-related resources with this RWLock. /// Destroys OS-related resources with this RWLock.
/// ///
/// Behavior is undefined if there are any currently active users of this /// Behavior is undefined if there are any currently active users of this
/// lock. /// lock.

View file

@ -207,7 +207,7 @@ impl StaticKey {
} }
impl Key { impl Key {
/// Create a new managed OS TLS key. /// Creates a new managed OS TLS key.
/// ///
/// This key will be deallocated when the key falls out of scope. /// This key will be deallocated when the key falls out of scope.
/// ///

View file

@ -69,7 +69,7 @@ impl fmt::Debug for CodePoint {
} }
impl CodePoint { impl CodePoint {
/// Unsafely create a new `CodePoint` without checking the value. /// Unsafely creates a new `CodePoint` without checking the value.
/// ///
/// Only use when `value` is known to be less than or equal to 0x10FFFF. /// Only use when `value` is known to be less than or equal to 0x10FFFF.
#[inline] #[inline]
@ -77,9 +77,9 @@ impl CodePoint {
CodePoint { value: value } CodePoint { value: value }
} }
/// Create a new `CodePoint` if the value is a valid code point. /// Creates a new `CodePoint` if the value is a valid code point.
/// ///
/// Return `None` if `value` is above 0x10FFFF. /// Returns `None` if `value` is above 0x10FFFF.
#[inline] #[inline]
pub fn from_u32(value: u32) -> Option<CodePoint> { pub fn from_u32(value: u32) -> Option<CodePoint> {
match value { match value {
@ -88,7 +88,7 @@ impl CodePoint {
} }
} }
/// Create a new `CodePoint` from a `char`. /// Creates a new `CodePoint` from a `char`.
/// ///
/// Since all Unicode scalar values are code points, this always succeeds. /// Since all Unicode scalar values are code points, this always succeeds.
#[inline] #[inline]
@ -96,15 +96,15 @@ impl CodePoint {
CodePoint { value: value as u32 } CodePoint { value: value as u32 }
} }
/// Return the numeric value of the code point. /// Returns the numeric value of the code point.
#[inline] #[inline]
pub fn to_u32(&self) -> u32 { pub fn to_u32(&self) -> u32 {
self.value self.value
} }
/// Optionally return a Unicode scalar value for the code point. /// Optionally returns a Unicode scalar value for the code point.
/// ///
/// Return `None` if the code point is a surrogate (from U+D800 to U+DFFF). /// Returns `None` if the code point is a surrogate (from U+D800 to U+DFFF).
#[inline] #[inline]
pub fn to_char(&self) -> Option<char> { pub fn to_char(&self) -> Option<char> {
match self.value { match self.value {
@ -113,9 +113,9 @@ impl CodePoint {
} }
} }
/// Return a Unicode scalar value for the code point. /// Returns a Unicode scalar value for the code point.
/// ///
/// Return `'\u{FFFD}'` (the replacement character “<>”) /// Returns `'\u{FFFD}'` (the replacement character “<>”)
/// if the code point is a surrogate (from U+D800 to U+DFFF). /// if the code point is a surrogate (from U+D800 to U+DFFF).
#[inline] #[inline]
pub fn to_char_lossy(&self) -> char { pub fn to_char_lossy(&self) -> char {
@ -151,19 +151,19 @@ impl fmt::Debug for Wtf8Buf {
} }
impl Wtf8Buf { impl Wtf8Buf {
/// Create an new, empty WTF-8 string. /// Creates an new, empty WTF-8 string.
#[inline] #[inline]
pub fn new() -> Wtf8Buf { pub fn new() -> Wtf8Buf {
Wtf8Buf { bytes: Vec::new() } Wtf8Buf { bytes: Vec::new() }
} }
/// Create an new, empty WTF-8 string with pre-allocated capacity for `n` bytes. /// Creates an new, empty WTF-8 string with pre-allocated capacity for `n` bytes.
#[inline] #[inline]
pub fn with_capacity(n: usize) -> Wtf8Buf { pub fn with_capacity(n: usize) -> Wtf8Buf {
Wtf8Buf { bytes: Vec::with_capacity(n) } Wtf8Buf { bytes: Vec::with_capacity(n) }
} }
/// Create a WTF-8 string from an UTF-8 `String`. /// Creates a WTF-8 string from an UTF-8 `String`.
/// ///
/// This takes ownership of the `String` and does not copy. /// This takes ownership of the `String` and does not copy.
/// ///
@ -173,7 +173,7 @@ impl Wtf8Buf {
Wtf8Buf { bytes: string.into_bytes() } Wtf8Buf { bytes: string.into_bytes() }
} }
/// Create a WTF-8 string from an UTF-8 `&str` slice. /// Creates a WTF-8 string from an UTF-8 `&str` slice.
/// ///
/// This copies the content of the slice. /// This copies the content of the slice.
/// ///
@ -183,7 +183,7 @@ impl Wtf8Buf {
Wtf8Buf { bytes: <[_]>::to_vec(str.as_bytes()) } Wtf8Buf { bytes: <[_]>::to_vec(str.as_bytes()) }
} }
/// Create a WTF-8 string from a potentially ill-formed UTF-16 slice of 16-bit code units. /// Creates a WTF-8 string from a potentially ill-formed UTF-16 slice of 16-bit code units.
/// ///
/// This is lossless: calling `.encode_wide()` on the resulting string /// This is lossless: calling `.encode_wide()` on the resulting string
/// will always return the original code units. /// will always return the original code units.
@ -319,7 +319,7 @@ impl Wtf8Buf {
self.bytes.truncate(new_len) self.bytes.truncate(new_len)
} }
/// Consume the WTF-8 string and try to convert it to UTF-8. /// Consumes the WTF-8 string and tries to convert it to UTF-8.
/// ///
/// This does not copy the data. /// This does not copy the data.
/// ///
@ -333,7 +333,7 @@ impl Wtf8Buf {
} }
} }
/// Consume the WTF-8 string and convert it lossily to UTF-8. /// Consumes the WTF-8 string and converts it lossily to UTF-8.
/// ///
/// This does not copy the data (but may overwrite parts of it in place). /// This does not copy the data (but may overwrite parts of it in place).
/// ///
@ -454,7 +454,7 @@ impl fmt::Debug for Wtf8 {
} }
impl Wtf8 { impl Wtf8 {
/// Create a WTF-8 slice from a UTF-8 `&str` slice. /// Creates a WTF-8 slice from a UTF-8 `&str` slice.
/// ///
/// Since WTF-8 is a superset of UTF-8, this always succeeds. /// Since WTF-8 is a superset of UTF-8, this always succeeds.
#[inline] #[inline]
@ -462,13 +462,13 @@ impl Wtf8 {
unsafe { mem::transmute(value.as_bytes()) } unsafe { mem::transmute(value.as_bytes()) }
} }
/// Return the length, in WTF-8 bytes. /// Returns the length, in WTF-8 bytes.
#[inline] #[inline]
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.bytes.len() self.bytes.len()
} }
/// Return the code point at `position` if it is in the ASCII range, /// Returns the code point at `position` if it is in the ASCII range,
/// or `b'\xFF' otherwise. /// or `b'\xFF' otherwise.
/// ///
/// # Panics /// # Panics
@ -482,7 +482,7 @@ impl Wtf8 {
} }
} }
/// Return the code point at `position`. /// Returns the code point at `position`.
/// ///
/// # Panics /// # Panics
/// ///
@ -494,7 +494,7 @@ impl Wtf8 {
code_point code_point
} }
/// Return the code point at `position` /// Returns the code point at `position`
/// and the position of the next code point. /// and the position of the next code point.
/// ///
/// # Panics /// # Panics
@ -507,15 +507,15 @@ impl Wtf8 {
(CodePoint { value: c }, n) (CodePoint { value: c }, n)
} }
/// Return an iterator for the strings code points. /// Returns an iterator for the strings code points.
#[inline] #[inline]
pub fn code_points(&self) -> Wtf8CodePoints { pub fn code_points(&self) -> Wtf8CodePoints {
Wtf8CodePoints { bytes: self.bytes.iter() } Wtf8CodePoints { bytes: self.bytes.iter() }
} }
/// Try to convert the string to UTF-8 and return a `&str` slice. /// Tries to convert the string to UTF-8 and return a `&str` slice.
/// ///
/// Return `None` if the string contains surrogates. /// Returns `None` if the string contains surrogates.
/// ///
/// This does not copy the data. /// This does not copy the data.
#[inline] #[inline]
@ -528,8 +528,8 @@ impl Wtf8 {
} }
} }
/// Lossily convert the string to UTF-8. /// Lossily converts the string to UTF-8.
/// Return an UTF-8 `&str` slice if the contents are well-formed in UTF-8. /// Returns an UTF-8 `&str` slice if the contents are well-formed in UTF-8.
/// ///
/// Surrogates are replaced with `"\u{FFFD}"` (the replacement character “<>”). /// Surrogates are replaced with `"\u{FFFD}"` (the replacement character “<>”).
/// ///
@ -559,7 +559,7 @@ impl Wtf8 {
} }
} }
/// Convert the WTF-8 string to potentially ill-formed UTF-16 /// Converts the WTF-8 string to potentially ill-formed UTF-16
/// and return an iterator of 16-bit code units. /// and return an iterator of 16-bit code units.
/// ///
/// This is lossless: /// This is lossless:

View file

@ -50,7 +50,7 @@ pub mod io {
/// and `AsRawSocket` set of traits. /// and `AsRawSocket` set of traits.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait AsRawFd { pub trait AsRawFd {
/// Extract the raw file descriptor. /// Extracts the raw file descriptor.
/// ///
/// This method does **not** pass ownership of the raw file descriptor /// This method does **not** pass ownership of the raw file descriptor
/// to the caller. The descriptor is only guarantee to be valid while /// to the caller. The descriptor is only guarantee to be valid while
@ -144,11 +144,11 @@ pub mod ffi {
/// Unix-specific extensions to `OsString`. /// Unix-specific extensions to `OsString`.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStringExt { pub trait OsStringExt {
/// Create an `OsString` from a byte vector. /// Creates an `OsString` from a byte vector.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn from_vec(vec: Vec<u8>) -> Self; fn from_vec(vec: Vec<u8>) -> Self;
/// Yield the underlying byte vector of this `OsString`. /// Yields the underlying byte vector of this `OsString`.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn into_vec(self) -> Vec<u8>; fn into_vec(self) -> Vec<u8>;
} }
@ -169,7 +169,7 @@ pub mod ffi {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn from_bytes(slice: &[u8]) -> &Self; fn from_bytes(slice: &[u8]) -> &Self;
/// Get the underlying byte view of the `OsStr` slice. /// Gets the underlying byte view of the `OsStr` slice.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_bytes(&self) -> &[u8]; fn as_bytes(&self) -> &[u8];
} }
@ -208,7 +208,7 @@ pub mod fs {
/// Unix-specific extensions to `OpenOptions` /// Unix-specific extensions to `OpenOptions`
pub trait OpenOptionsExt { pub trait OpenOptionsExt {
/// Set the mode bits that a new file will be created with. /// Sets the mode bits that a new file will be created with.
/// ///
/// If a new file is created as part of a `File::open_opts` call then this /// If a new file is created as part of a `File::open_opts` call then this
/// specified `mode` will be used as the permission bits for the new file. /// specified `mode` will be used as the permission bits for the new file.

View file

@ -28,7 +28,7 @@ impl FileDesc {
pub fn raw(&self) -> c_int { self.fd } pub fn raw(&self) -> c_int { self.fd }
/// Extract the actual filedescriptor without closing it. /// Extracts the actual filedescriptor without closing it.
pub fn into_raw(self) -> c_int { pub fn into_raw(self) -> c_int {
let fd = self.fd; let fd = self.fd;
unsafe { mem::forget(self) }; unsafe { mem::forget(self) };

View file

@ -84,7 +84,7 @@ pub fn errno() -> i32 {
} }
} }
/// Get a detailed string description for the given error number /// Gets a detailed string description for the given error number.
pub fn error_string(errno: i32) -> String { pub fn error_string(errno: i32) -> String {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
extern { extern {

View file

@ -35,7 +35,7 @@ pub mod io {
/// Extract raw handles. /// Extract raw handles.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait AsRawHandle { pub trait AsRawHandle {
/// Extract the raw handle, without taking any ownership. /// Extracts the raw handle, without taking any ownership.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_raw_handle(&self) -> RawHandle; fn as_raw_handle(&self) -> RawHandle;
} }
@ -44,7 +44,7 @@ pub mod io {
#[unstable(feature = "from_raw_os", #[unstable(feature = "from_raw_os",
reason = "recent addition to the std::os::windows::io module")] reason = "recent addition to the std::os::windows::io module")]
pub trait FromRawHandle { pub trait FromRawHandle {
/// Construct a new I/O object from the specified raw handle. /// Constructs a new I/O object from the specified raw handle.
/// ///
/// This function will **consume ownership** of the handle given, /// This function will **consume ownership** of the handle given,
/// passing responsibility for closing the handle to the returned /// passing responsibility for closing the handle to the returned
@ -75,7 +75,7 @@ pub mod io {
/// Extract raw sockets. /// Extract raw sockets.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait AsRawSocket { pub trait AsRawSocket {
/// Extract the underlying raw socket from this object. /// Extracts the underlying raw socket from this object.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_raw_socket(&self) -> RawSocket; fn as_raw_socket(&self) -> RawSocket;
} }
@ -151,7 +151,7 @@ pub mod ffi {
/// Windows-specific extensions to `OsString`. /// Windows-specific extensions to `OsString`.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStringExt { pub trait OsStringExt {
/// Create an `OsString` from a potentially ill-formed UTF-16 slice of /// Creates an `OsString` from a potentially ill-formed UTF-16 slice of
/// 16-bit code units. /// 16-bit code units.
/// ///
/// This is lossless: calling `.encode_wide()` on the resulting string /// This is lossless: calling `.encode_wide()` on the resulting string
@ -170,7 +170,7 @@ pub mod ffi {
/// Windows-specific extensions to `OsStr`. /// Windows-specific extensions to `OsStr`.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStrExt { pub trait OsStrExt {
/// Re-encode an `OsStr` as a wide character sequence, /// Re-encodes an `OsStr` as a wide character sequence,
/// i.e. potentially ill-formed UTF-16. /// i.e. potentially ill-formed UTF-16.
/// ///
/// This is lossless. Note that the encoding does not include a final /// This is lossless. Note that the encoding does not include a final
@ -195,25 +195,25 @@ pub mod fs {
/// Windows-specific extensions to `OpenOptions` /// Windows-specific extensions to `OpenOptions`
pub trait OpenOptionsExt { pub trait OpenOptionsExt {
/// Override the `dwDesiredAccess` argument to the call to `CreateFile` /// Overrides the `dwDesiredAccess` argument to the call to `CreateFile`
/// with the specified value. /// with the specified value.
fn desired_access(&mut self, access: i32) -> &mut Self; fn desired_access(&mut self, access: i32) -> &mut Self;
/// Override the `dwCreationDisposition` argument to the call to /// Overrides the `dwCreationDisposition` argument to the call to
/// `CreateFile` with the specified value. /// `CreateFile` with the specified value.
/// ///
/// This will override any values of the standard `create` flags, for /// This will override any values of the standard `create` flags, for
/// example. /// example.
fn creation_disposition(&mut self, val: i32) -> &mut Self; fn creation_disposition(&mut self, val: i32) -> &mut Self;
/// Override the `dwFlagsAndAttributes` argument to the call to /// Overrides the `dwFlagsAndAttributes` argument to the call to
/// `CreateFile` with the specified value. /// `CreateFile` with the specified value.
/// ///
/// This will override any values of the standard flags on the /// This will override any values of the standard flags on the
/// `OpenOptions` structure. /// `OpenOptions` structure.
fn flags_and_attributes(&mut self, val: i32) -> &mut Self; fn flags_and_attributes(&mut self, val: i32) -> &mut Self;
/// Override the `dwShareMode` argument to the call to `CreateFile` with /// Overrides the `dwShareMode` argument to the call to `CreateFile` with
/// the specified value. /// the specified value.
/// ///
/// This will override any values of the standard flags on the /// This will override any values of the standard flags on the

View file

@ -39,7 +39,7 @@ pub fn errno() -> i32 {
unsafe { libc::GetLastError() as i32 } unsafe { libc::GetLastError() as i32 }
} }
/// Get a detailed string description for the given error number /// Gets a detailed string description for the given error number.
pub fn error_string(errnum: i32) -> String { pub fn error_string(errnum: i32) -> String {
use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::DWORD;
use libc::types::os::arch::extra::LPWSTR; use libc::types::os::arch::extra::LPWSTR;

View file

@ -226,7 +226,7 @@ pub enum LocalKeyState {
} }
impl<T: 'static> LocalKey<T> { impl<T: 'static> LocalKey<T> {
/// Acquire a reference to the value in this TLS key. /// Acquires a reference to the value in this TLS key.
/// ///
/// This will lazily initialize the value if this thread has not referenced /// This will lazily initialize the value if this thread has not referenced
/// this key yet. /// this key yet.

View file

@ -215,7 +215,7 @@ pub struct Builder {
} }
impl Builder { impl Builder {
/// Generate the base configuration for spawning a thread, from which /// Generates the base configuration for spawning a thread, from which
/// configuration methods can be chained. /// configuration methods can be chained.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> Builder { pub fn new() -> Builder {
@ -225,7 +225,7 @@ impl Builder {
} }
} }
/// Name the thread-to-be. Currently the name is used for identification /// Names the thread-to-be. Currently the name is used for identification
/// only in panic messages. /// only in panic messages.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn name(mut self, name: String) -> Builder { pub fn name(mut self, name: String) -> Builder {
@ -233,14 +233,14 @@ impl Builder {
self self
} }
/// Set the size of the stack for the new thread. /// Sets the size of the stack for the new thread.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn stack_size(mut self, size: usize) -> Builder { pub fn stack_size(mut self, size: usize) -> Builder {
self.stack_size = Some(size); self.stack_size = Some(size);
self self
} }
/// Spawn a new thread, and return a join handle for it. /// Spawns a new thread, and returns a join handle for it.
/// ///
/// The child thread may outlive the parent (unless the parent thread /// The child thread may outlive the parent (unless the parent thread
/// is the main thread; the whole process is terminated when the main /// is the main thread; the whole process is terminated when the main
@ -259,8 +259,8 @@ impl Builder {
self.spawn_inner(Box::new(f)).map(|i| JoinHandle(i)) self.spawn_inner(Box::new(f)).map(|i| JoinHandle(i))
} }
/// Spawn a new child thread that must be joined within a given /// Spawns a new child thread that must be joined within a given
/// scope, and return a `JoinGuard`. /// scope, and returns a `JoinGuard`.
/// ///
/// The join guard can be used to explicitly join the child thread (via /// The join guard can be used to explicitly join the child thread (via
/// `join`), returning `Result<T>`, or it will implicitly join the child /// `join`), returning `Result<T>`, or it will implicitly join the child
@ -355,7 +355,7 @@ impl Builder {
// Free functions // Free functions
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// Spawn a new thread, returning a `JoinHandle` for it. /// Spawns a new thread, returning a `JoinHandle` for it.
/// ///
/// The join handle will implicitly *detach* the child thread upon being /// The join handle will implicitly *detach* the child thread upon being
/// dropped. In this case, the child thread may outlive the parent (unless /// dropped. In this case, the child thread may outlive the parent (unless
@ -374,7 +374,7 @@ pub fn spawn<F>(f: F) -> JoinHandle where F: FnOnce(), F: Send + 'static {
Builder::new().spawn(f).unwrap() Builder::new().spawn(f).unwrap()
} }
/// Spawn a new *scoped* thread, returning a `JoinGuard` for it. /// Spawns a new *scoped* thread, returning a `JoinGuard` for it.
/// ///
/// The join guard can be used to explicitly join the child thread (via /// The join guard can be used to explicitly join the child thread (via
/// `join`), returning `Result<T>`, or it will implicitly join the child /// `join`), returning `Result<T>`, or it will implicitly join the child
@ -400,7 +400,7 @@ pub fn current() -> Thread {
thread_info::current_thread() thread_info::current_thread()
} }
/// Cooperatively give up a timeslice to the OS scheduler. /// Cooperatively gives up a timeslice to the OS scheduler.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn yield_now() { pub fn yield_now() {
unsafe { imp::yield_now() } unsafe { imp::yield_now() }
@ -413,7 +413,7 @@ pub fn panicking() -> bool {
unwind::panicking() unwind::panicking()
} }
/// Invoke a closure, capturing the cause of panic if one occurs. /// Invokes a closure, capturing the cause of panic if one occurs.
/// ///
/// This function will return `Ok(())` if the closure does not panic, and will /// This function will return `Ok(())` if the closure does not panic, and will
/// return `Err(cause)` if the closure panics. The `cause` returned is the /// return `Err(cause)` if the closure panics. The `cause` returned is the
@ -462,7 +462,7 @@ pub fn catch_panic<F, R>(f: F) -> Result<R>
Ok(result.unwrap()) Ok(result.unwrap())
} }
/// Put the current thread to sleep for the specified amount of time. /// Puts the current thread to sleep for the specified amount of time.
/// ///
/// The thread may sleep longer than the duration specified due to scheduling /// The thread may sleep longer than the duration specified due to scheduling
/// specifics or platform-dependent functionality. Note that on unix platforms /// specifics or platform-dependent functionality. Note that on unix platforms
@ -482,7 +482,7 @@ pub fn sleep(dur: Duration) {
imp::sleep(dur) imp::sleep(dur)
} }
/// Block unless or until the current thread's token is made available (may wake spuriously). /// Blocks unless or until the current thread's token is made available (may wake spuriously).
/// ///
/// See the module doc for more detail. /// See the module doc for more detail.
// //
@ -501,7 +501,7 @@ pub fn park() {
*guard = false; *guard = false;
} }
/// Block unless or until the current thread's token is made available or /// Blocks unless or until the current thread's token is made available or
/// the specified duration has been reached (may wake spuriously). /// the specified duration has been reached (may wake spuriously).
/// ///
/// The semantics of this function are equivalent to `park()` except that the /// The semantics of this function are equivalent to `park()` except that the
@ -573,7 +573,7 @@ impl Thread {
} }
} }
/// Get the thread's name. /// Gets the thread's name.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn name(&self) -> Option<&str> { pub fn name(&self) -> Option<&str> {
self.inner.name.as_ref().map(|s| &**s) self.inner.name.as_ref().map(|s| &**s)
@ -638,13 +638,13 @@ impl<T> JoinInner<T> {
pub struct JoinHandle(JoinInner<()>); pub struct JoinHandle(JoinInner<()>);
impl JoinHandle { impl JoinHandle {
/// Extract a handle to the underlying thread /// Extracts a handle to the underlying thread
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn thread(&self) -> &Thread { pub fn thread(&self) -> &Thread {
&self.0.thread &self.0.thread
} }
/// Wait for the associated thread to finish. /// Waits for the associated thread to finish.
/// ///
/// If the child thread panics, `Err` is returned with the parameter given /// If the child thread panics, `Err` is returned with the parameter given
/// to `panic`. /// to `panic`.
@ -684,13 +684,13 @@ pub struct JoinGuard<'a, T: Send + 'a> {
unsafe impl<'a, T: Send + 'a> Sync for JoinGuard<'a, T> {} unsafe impl<'a, T: Send + 'a> Sync for JoinGuard<'a, T> {}
impl<'a, T: Send + 'a> JoinGuard<'a, T> { impl<'a, T: Send + 'a> JoinGuard<'a, T> {
/// Extract a handle to the thread this guard will join on. /// Extracts a handle to the thread this guard will join on.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn thread(&self) -> &Thread { pub fn thread(&self) -> &Thread {
&self.inner.thread &self.inner.thread
} }
/// Wait for the associated thread to finish, returning the result of the /// Waits for the associated thread to finish, returning the result of the
/// thread's calculation. /// thread's calculation.
/// ///
/// # Panics /// # Panics

View file

@ -135,7 +135,7 @@ macro_rules! __scoped_thread_local_inner {
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")]
impl<T> ScopedKey<T> { impl<T> ScopedKey<T> {
/// Insert a value into this scoped thread local storage slot for a /// Inserts a value into this scoped thread local storage slot for a
/// duration of a closure. /// duration of a closure.
/// ///
/// While `cb` is running, the value `t` will be returned by `get` unless /// While `cb` is running, the value `t` will be returned by `get` unless
@ -188,7 +188,7 @@ impl<T> ScopedKey<T> {
cb() cb()
} }
/// Get a value out of this scoped variable. /// Gets a value out of this scoped variable.
/// ///
/// This function takes a closure which receives the value of this /// This function takes a closure which receives the value of this
/// variable. /// variable.