pluralize doc comment verbs and add missing periods

This commit is contained in:
Andrew Paseltiner
2015-04-13 10:21:32 -04:00
parent 588d37c653
commit 6fa16d6a47
66 changed files with 380 additions and 380 deletions

View File

@@ -91,7 +91,7 @@ use marker::{Reflect, Sized};
/// [mod]: index.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Any: Reflect + 'static {
/// Get the `TypeId` of `self`
/// Gets the `TypeId` of `self`.
#[unstable(feature = "core",
reason = "this method will likely be replaced by an associated static")]
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
///
@@ -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.
///
@@ -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.
///
@@ -647,7 +647,7 @@ pub struct UnsafeCell<T> {
impl<T> !Sync for 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.
///
/// 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
}
/// Unwraps the value
/// Unwraps the value.
///
/// # Unsafety
///

View File

@@ -38,7 +38,7 @@ pub trait Clone : Sized {
#[stable(feature = "rust1", since = "1.0.0")]
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,
/// 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")]
impl<'a, T: ?Sized> Clone for &'a T {
/// Return a shallow copy of the reference.
/// Returns a shallow copy of the reference.
#[inline]
fn clone(&self) -> &'a T { *self }
}
@@ -61,7 +61,7 @@ macro_rules! clone_impl {
($t:ty) => {
#[stable(feature = "rust1", since = "1.0.0")]
impl Clone for $t {
/// Return a deep copy of the value.
/// Returns a deep copy of the value.
#[inline]
fn clone(&self) -> $t { *self }
}
@@ -92,28 +92,28 @@ macro_rules! extern_fn_clone {
#[unstable(feature = "core",
reason = "this may not be sufficient for fns with region parameters")]
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]
fn clone(&self) -> extern "Rust" fn($($A),*) -> ReturnType { *self }
}
#[unstable(feature = "core", reason = "brand new")]
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]
fn clone(&self) -> extern "C" fn($($A),*) -> ReturnType { *self }
}
#[unstable(feature = "core", reason = "brand new")]
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]
fn clone(&self) -> unsafe extern "Rust" fn($($A),*) -> ReturnType { *self }
}
#[unstable(feature = "core", reason = "brand new")]
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]
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_acqrel();
/// Abort the execution of the process.
/// Aborts the execution of the process.
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.
///
/// NB: This is very different from the `unreachable!()` macro!
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.
///
/// 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.
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();
/// The size of a type in bytes.
@@ -170,7 +170,7 @@ extern "rust-intrinsic" {
/// elements.
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.
pub fn move_val_init<T>(dst: &mut T, src: T);
@@ -186,7 +186,7 @@ extern "rust-intrinsic" {
/// crate it is invoked in.
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.
///
/// `init_dropped` is unsafe because it returns a datum with all
@@ -199,7 +199,7 @@ extern "rust-intrinsic" {
/// intrinsic).
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,
/// 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.
pub fn init<T>() -> T;
/// Create an uninitialized value.
/// Creates an uninitialized value.
///
/// `uninit` is unsafe because there is no guarantee of what its
/// 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`.
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
/// ensuring the argument is deallocated already.

View File

@@ -91,7 +91,7 @@ pub trait Iterator {
#[stable(feature = "rust1", since = "1.0.0")]
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.
#[stable(feature = "rust1", since = "1.0.0")]
fn next(&mut self) -> Option<Self::Item>;
@@ -670,7 +670,7 @@ pub trait Iterator {
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.
///
@@ -698,7 +698,7 @@ pub trait Iterator {
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.
///
@@ -853,7 +853,7 @@ pub trait Iterator {
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.
///
/// Returns the rightmost element if the comparison determines two elements
@@ -882,7 +882,7 @@ pub trait Iterator {
.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.
///
/// 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 \
built from an iterator over elements of type `{A}`"]
pub trait FromIterator<A> {
/// Build a container with elements from something iterable.
/// Builds a container with elements from something iterable.
///
/// # Examples
///
@@ -1158,7 +1158,7 @@ impl<I: Iterator> IntoIterator for I {
/// A type growable from an `Iterator` implementation
#[stable(feature = "rust1", since = "1.0.0")]
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")]
fn extend<T: IntoIterator<Item=A>>(&mut self, iterable: T);
}
@@ -1170,7 +1170,7 @@ pub trait Extend<A> {
/// independently of each other.
#[stable(feature = "rust1", since = "1.0.0")]
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.
#[stable(feature = "rust1", since = "1.0.0")]
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 \
and ExactSizeIterator")]
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.
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>;
}
@@ -1210,7 +1210,7 @@ pub trait RandomAccessIterator: Iterator {
pub trait ExactSizeIterator: Iterator {
#[inline]
#[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 {
let (lower, upper) = self.size_hint();
// 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")]
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.
#[inline]
#[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]
pub fn is_empty(&mut self) -> bool {
self.peek().is_none()
@@ -2401,12 +2401,12 @@ pub trait Step: PartialOrd {
/// Steps `self` if possible.
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
/// 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.
fn steps_between(start: &Self, end: &Self, by: &Self) -> Option<usize>;
}
@@ -2549,7 +2549,7 @@ pub struct RangeInclusive<A> {
done: bool,
}
/// Return an iterator over the range [start, stop]
/// Returns an iterator over the range [start, stop].
#[inline]
#[unstable(feature = "core",
reason = "likely to be replaced by range notation and adapters")]
@@ -2657,7 +2657,7 @@ pub struct RangeStepInclusive<A> {
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.
///
@@ -2827,7 +2827,7 @@ type IterateState<T, F> = (F, Option<T>, bool);
#[unstable(feature = "core")]
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`.
#[unstable(feature = "core")]
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)
}
/// Create a new iterator that endlessly repeats the element `elt`.
/// Creates a new iterator that endlessly repeats the element `elt`.
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
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
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
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
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
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
L::Item: PartialOrd<R::Item>,
{

View File

@@ -134,7 +134,7 @@ pub fn align_of_val<T>(_val: &T) -> usize {
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
/// operation).
@@ -158,7 +158,7 @@ pub unsafe fn zeroed<T>() -> T {
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
/// in question has been dropped. Thus, *if* T carries a drop flag,
@@ -179,7 +179,7 @@ pub unsafe fn dropped<T>() -> T {
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
/// 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.
///
/// 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);
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".
#[inline(always)]
pub unsafe fn new(inner: T) -> NonZero<T> {

View File

@@ -268,7 +268,7 @@ pub trait Int
#[stable(feature = "rust1", since = "1.0.0")]
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.
///
@@ -291,7 +291,7 @@ pub trait Int
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.
///
@@ -314,7 +314,7 @@ pub trait Int
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.
///
@@ -337,7 +337,7 @@ pub trait Int
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.
///
@@ -845,7 +845,7 @@ macro_rules! int_impl {
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.
///
@@ -995,7 +995,7 @@ macro_rules! int_impl {
(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
/// swapped.
@@ -1019,7 +1019,7 @@ macro_rules! int_impl {
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.
@@ -1043,7 +1043,7 @@ macro_rules! int_impl {
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.
@@ -1067,7 +1067,7 @@ macro_rules! int_impl {
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.
@@ -1361,7 +1361,7 @@ macro_rules! uint_impl {
#[stable(feature = "rust1", since = "1.0.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.
///
@@ -1517,7 +1517,7 @@ macro_rules! uint_impl {
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
/// swapped.
@@ -1541,7 +1541,7 @@ macro_rules! uint_impl {
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.
@@ -1565,7 +1565,7 @@ macro_rules! uint_impl {
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.
@@ -1589,7 +1589,7 @@ macro_rules! uint_impl {
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.
@@ -2183,7 +2183,7 @@ impl_to_primitive_float! { f64 }
/// A generic trait for converting a number to a value.
#[unstable(feature = "core", reason = "trait is likely to be removed")]
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.
#[inline]
#[unstable(feature = "core")]
@@ -2192,39 +2192,39 @@ pub trait FromPrimitive : ::marker::Sized {
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.
#[inline]
fn from_isize(n: isize) -> Option<Self> {
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.
#[inline]
fn from_i8(n: i8) -> Option<Self> {
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.
#[inline]
fn from_i16(n: i16) -> Option<Self> {
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.
#[inline]
fn from_i32(n: i32) -> Option<Self> {
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.
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.
#[inline]
#[unstable(feature = "core")]
@@ -2233,46 +2233,46 @@ pub trait FromPrimitive : ::marker::Sized {
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.
#[inline]
fn from_usize(n: usize) -> Option<Self> {
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.
#[inline]
fn from_u8(n: u8) -> Option<Self> {
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.
#[inline]
fn from_u16(n: u16) -> Option<Self> {
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.
#[inline]
fn from_u32(n: u32) -> Option<Self> {
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.
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.
#[inline]
fn from_f32(n: f32) -> Option<Self> {
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.
#[inline]
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! { f64, to_f64 }
/// Cast from one machine scalar to another.
/// Casts from one machine scalar to another.
///
/// # Examples
///
@@ -2583,16 +2583,16 @@ pub trait Float
/// Returns the mantissa, exponent and sign as integers, respectively.
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;
/// 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;
/// 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`.
fn round(self) -> Self;
/// Return the integer part of a number.
/// Returns the integer part of a number.
fn trunc(self) -> Self;
/// Return the fractional part of a number.
/// Returns the fractional part of a number.
fn fract(self) -> Self;
/// 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
/// a separate multiplication operation followed by an add.
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;
/// Raise a number to an integer power.
/// Raises a number to an integer power.
///
/// Using this function is generally faster than using `powf`
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;
/// Take the square root of a number.
/// Takes the square root of a number.
///
/// Returns NaN if `self` is a negative number.
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;
/// Returns `e^(self)`, (the exponential function).
@@ -2645,9 +2645,9 @@ pub trait Float
/// Returns the base 10 logarithm of the number.
fn log10(self) -> Self;
/// Convert radians to degrees.
/// Converts radians to degrees.
fn to_degrees(self) -> Self;
/// Convert degrees to radians.
/// Converts degrees to radians.
fn to_radians(self) -> Self;
}
@@ -2682,7 +2682,7 @@ macro_rules! from_str_radix_float_impl {
impl FromStr for $T {
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.
///
/// This function accepts strings such as
@@ -2719,7 +2719,7 @@ macro_rules! from_str_radix_float_impl {
impl FromStrRadix for $T {
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
/// the special values `inf`, `-inf`, `+inf` and `NaN`, **nor**

View File

@@ -223,7 +223,7 @@ impl<T> Option<T> {
// Adapter for working with references
/////////////////////////////////////////////////////////////////////////
/// Convert from `Option<T>` to `Option<&T>`
/// Converts from `Option<T>` to `Option<&T>`
///
/// # 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
///
@@ -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
///
@@ -704,7 +704,7 @@ impl<T> Option<T> {
mem::replace(self, None)
}
/// Convert from `Option<T>` to `&[T]` (without copying)
/// Converts from `Option<T>` to `&[T]` (without copying)
#[inline]
#[unstable(feature = "as_slice", since = "unsure of the utility here")]
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> { }
impl<T: ?Sized> Unique<T> {
/// Create a new `Unique`.
/// Creates a new `Unique`.
#[unstable(feature = "unique")]
pub unsafe fn new(ptr: *mut T) -> Unique<T> {
Unique { pointer: NonZero::new(ptr), _marker: PhantomData }
}
/// Dereference the content.
/// Dereferences the content.
#[unstable(feature = "unique")]
pub unsafe fn get(&self) -> &T {
&**self.pointer
}
/// Mutably dereference the content.
/// Mutably dereferences the content.
#[unstable(feature = "unique")]
pub unsafe fn get_mut(&mut self) -> &mut T {
&mut ***self

View File

@@ -311,7 +311,7 @@ impl<T, E> Result<T, E> {
// 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`,
/// and discarding the error, if any.
@@ -334,7 +334,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`,
/// and discarding the success value, if any.
@@ -361,7 +361,7 @@ impl<T, E> Result<T, E> {
// 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
/// into the original, leaving the original in place.
@@ -382,7 +382,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>) {
@@ -409,7 +409,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]
#[unstable(feature = "as_slice", since = "unsure of the utility here")]
pub fn as_slice(&self) -> &[T] {
@@ -423,7 +423,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)]
@@ -811,7 +811,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
reason = "use inherent method instead")]
#[allow(deprecated)]
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]
fn as_slice<'a>(&'a self) -> &'a [T] {
match *self {
@@ -974,7 +974,7 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
// 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.
/// Otherwise, the folded value is returned.

View File

@@ -32,17 +32,17 @@ pub trait Pattern<'a>: Sized {
/// Associated searcher for this pattern
type Searcher: Searcher<'a>;
/// Construct the associated searcher from
/// Constructs the associated searcher from
/// `self` and the `haystack` to search in.
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]
fn is_contained_in(self, haystack: &'a str) -> bool {
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]
fn is_prefix_of(self, haystack: &'a str) -> bool {
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]
fn is_suffix_of(self, haystack: &'a str) -> bool
where Self::Searcher: ReverseSearcher<'a>