Minor doc fixes in various places

This commit is contained in:
Piotr Jawniak 2014-05-19 15:39:16 +02:00
parent 5d2edddc30
commit cea63ecfb1
5 changed files with 32 additions and 25 deletions

View File

@ -2943,7 +2943,7 @@ See [Break expressions](#break-expressions) and [Continue expressions](#continue
break_expr : "break" [ lifetime ]; break_expr : "break" [ lifetime ];
~~~~ ~~~~
A `break` expression has an optional `label`. A `break` expression has an optional _label_.
If the label is absent, then executing a `break` expression immediately terminates the innermost loop enclosing it. If the label is absent, then executing a `break` expression immediately terminates the innermost loop enclosing it.
It is only permitted in the body of a loop. It is only permitted in the body of a loop.
If the label is present, then `break foo` terminates the loop with label `foo`, If the label is present, then `break foo` terminates the loop with label `foo`,
@ -2956,7 +2956,7 @@ but must enclose it.
continue_expr : "continue" [ lifetime ]; continue_expr : "continue" [ lifetime ];
~~~~ ~~~~
A `continue` expression has an optional `label`. A `continue` expression has an optional _label_.
If the label is absent, If the label is absent,
then executing a `continue` expression immediately terminates the current iteration of the innermost loop enclosing it, then executing a `continue` expression immediately terminates the current iteration of the innermost loop enclosing it,
returning control to the loop *head*. returning control to the loop *head*.
@ -3115,7 +3115,7 @@ let x: List<int> = Cons(10, box Cons(11, box Nil));
match x { match x {
Cons(a, box Cons(b, _)) => { Cons(a, box Cons(b, _)) => {
process_pair(a,b); process_pair(a, b);
} }
Cons(10, _) => { Cons(10, _) => {
process_ten(); process_ten();
@ -3329,8 +3329,8 @@ order specified by the tuple type.
An example of a tuple type and its use: An example of a tuple type and its use:
~~~~ ~~~~
type Pair<'a> = (int,&'a str); type Pair<'a> = (int, &'a str);
let p: Pair<'static> = (10,"hello"); let p: Pair<'static> = (10, "hello");
let (a, b) = p; let (a, b) = p;
assert!(b != "world"); assert!(b != "world");
~~~~ ~~~~

View File

@ -2602,7 +2602,7 @@ fn main() {
~~~ ~~~
The full list of derivable traits is `Eq`, `TotalEq`, `Ord`, The full list of derivable traits is `Eq`, `TotalEq`, `Ord`,
`TotalOrd`, `Encodable` `Decodable`, `Clone`, `TotalOrd`, `Encodable`, `Decodable`, `Clone`,
`Hash`, `Rand`, `Default`, `Zero`, `FromPrimitive` and `Show`. `Hash`, `Rand`, `Default`, `Zero`, `FromPrimitive` and `Show`.
# Crates and the module system # Crates and the module system

View File

@ -15,11 +15,14 @@
//! Implementations of the following traits: //! Implementations of the following traits:
//! //!
//! * `Not` //! * `Not`
//! * `BitAnd`
//! * `BitOr`
//! * `BitXor`
//! * `Ord` //! * `Ord`
//! * `TotalOrd` //! * `TotalOrd`
//! * `Eq` //! * `Eq`
//! * `TotalEq`
//! * `Default` //! * `Default`
//! * `Zero`
//! //!
//! A `to_bit` conversion function. //! A `to_bit` conversion function.

View File

@ -11,7 +11,7 @@
//! Numeric traits and functions for generic mathematics //! Numeric traits and functions for generic mathematics
//! //!
//! These are implemented for the primitive numeric types in `std::{u8, u16, //! These are implemented for the primitive numeric types in `std::{u8, u16,
//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64, float}`. //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`.
#![allow(missing_doc)] #![allow(missing_doc)]
@ -97,7 +97,7 @@ pub trait One: Mul<Self, Self> {
pub trait Signed: Num + Neg<Self> { pub trait Signed: Num + Neg<Self> {
/// Computes the absolute value. /// Computes the absolute value.
/// ///
/// For float, f32, and f64, `NaN` will be returned if the number is `NaN`. /// For `f32` and `f64`, `NaN` will be returned if the number is `NaN`.
fn abs(&self) -> Self; fn abs(&self) -> Self;
/// The positive difference of two numbers. /// The positive difference of two numbers.
@ -108,15 +108,17 @@ pub trait Signed: Num + Neg<Self> {
/// Returns the sign of the number. /// Returns the sign of the number.
/// ///
/// For `float`, `f32`, `f64`: /// For `f32` and `f64`:
/// * `1.0` if the number is positive, `+0.0` or `INFINITY` ///
/// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// * `1.0` if the number is positive, `+0.0` or `INFINITY`
/// * `NaN` if the number is `NaN` /// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
/// * `NaN` if the number is `NaN`
/// ///
/// For `int`: /// For `int`:
/// * `0` if the number is zero ///
/// * `1` if the number is positive /// * `0` if the number is zero
/// * `-1` if the number is negative /// * `1` if the number is positive
/// * `-1` if the number is negative
fn signum(&self) -> Self; fn signum(&self) -> Self;
/// Returns true if the number is positive and false if the number is zero or negative. /// Returns true if the number is positive and false if the number is zero or negative.
@ -128,7 +130,7 @@ pub trait Signed: Num + Neg<Self> {
/// Computes the absolute value. /// Computes the absolute value.
/// ///
/// For float, f32, and f64, `NaN` will be returned if the number is `NaN` /// For `f32` and `f64`, `NaN` will be returned if the number is `NaN`
#[inline(always)] #[inline(always)]
pub fn abs<T: Signed>(value: T) -> T { pub fn abs<T: Signed>(value: T) -> T {
value.abs() value.abs()
@ -145,15 +147,17 @@ pub fn abs_sub<T: Signed>(x: T, y: T) -> T {
/// Returns the sign of the number. /// Returns the sign of the number.
/// ///
/// For float, f32, f64: /// For `f32` and `f64`:
/// - `1.0` if the number is positive, `+0.0` or `INFINITY` ///
/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// * `1.0` if the number is positive, `+0.0` or `INFINITY`
/// - `NAN` if the number is `NAN` /// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
/// * `NaN` if the number is `NaN`
/// ///
/// For int: /// For int:
/// - `0` if the number is zero ///
/// - `1` if the number is positive /// * `0` if the number is zero
/// - `-1` if the number is negative /// * `1` if the number is positive
/// * `-1` if the number is negative
#[inline(always)] pub fn signum<T: Signed>(value: T) -> T { value.signum() } #[inline(always)] pub fn signum<T: Signed>(value: T) -> T { value.signum() }
/// A trait for values which cannot be negative /// A trait for values which cannot be negative

View File

@ -11,7 +11,7 @@
//! Numeric traits and functions for generic mathematics //! Numeric traits and functions for generic mathematics
//! //!
//! These are implemented for the primitive numeric types in `std::{u8, u16, //! These are implemented for the primitive numeric types in `std::{u8, u16,
//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64, float}`. //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`.
#![allow(missing_doc)] #![allow(missing_doc)]