diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 1ac2c9fc6bec6..024e70562ea31 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -26,7 +26,7 @@ use heap::deallocate; /// An atomically reference counted wrapper for shared state. /// -/// # Example +/// ## Example /// /// In this example, a large vector of floats is shared between several tasks. /// With simple pipes, without `Arc`, a copy would have to be made for each diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs index 3e1160b45eee4..4aa3ce7246b47 100644 --- a/src/libcollections/bitv.rs +++ b/src/libcollections/bitv.rs @@ -10,7 +10,7 @@ //! Collections implemented with bit vectors. //! -//! # Example +//! ## Example //! //! This is a simple example of the [Sieve of Eratosthenes][sieve] //! which calculates prime numbers up to a given limit. @@ -96,7 +96,7 @@ enum BitvVariant { Big(BigBitv), Small(SmallBitv) } /// The bitvector type /// -/// # Example +/// ## Example /// /// ```rust /// use collections::Bitv; @@ -209,7 +209,7 @@ impl Bitv { /// Create an empty Bitv. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -222,7 +222,7 @@ impl Bitv { /// Create a Bitv that holds `nbits` elements, setting each element /// to `init`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -243,11 +243,11 @@ impl Bitv { /// Retrieve the value at index `i`. /// - /// # Failure + /// ## Failure /// /// Assert if `i` out of bounds. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -270,11 +270,11 @@ impl Bitv { /// Set the value of a bit at a index `i`. /// - /// # Failure + /// ## Failure /// /// Assert if `i` out of bounds. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -295,7 +295,7 @@ impl Bitv { /// Set all bits to 1. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -314,7 +314,7 @@ impl Bitv { /// Flip all bits. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -336,11 +336,11 @@ impl Bitv { /// Set `self` to the union of `self` and `other`. Both bitvectors must be /// the same length. Return `true` if `self` changed. /// - /// # Failure + /// ## Failure /// /// Assert if the bitvectors are of different length. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -365,11 +365,11 @@ impl Bitv { /// Set `self` to the intersection of `self` and `other`. Both bitvectors /// must be the same length. Return `true` if `self` changed. /// - /// # Failure + /// ## Failure /// /// Assert if the bitvectors are of different length. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -395,11 +395,11 @@ impl Bitv { /// element of `other` at the same index. Both bitvectors must be the same /// length. Return `true` if `self` changed. /// - /// # Failure + /// ## Failure /// /// Assert if the bitvectors are of different length. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -428,7 +428,7 @@ impl Bitv { /// Returns `true` if all bits are 1. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -451,7 +451,7 @@ impl Bitv { /// Return an iterator over the elements of the vector in order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -466,7 +466,7 @@ impl Bitv { /// Return `true` if all bits are 0. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -483,7 +483,7 @@ impl Bitv { /// Return `true` if any bit is 1. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -504,7 +504,7 @@ impl Bitv { /// size of the `Bitv` is not a multiple of 8 then trailing bits /// will be filled-in with `false`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -546,7 +546,7 @@ impl Bitv { /// Transform `self` into a `Vec` by turning each bit into a `bool`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -561,11 +561,11 @@ impl Bitv { /// Compare a bitvector to a vector of `bool`. /// Both the bitvector and vector must have the same length. - /// # Failure + /// ## Failure /// /// Assert if the bitvectors are of different length. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -590,7 +590,7 @@ impl Bitv { /// If `len` is greater than the vector's current length, this has no /// effect. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -613,7 +613,7 @@ impl Bitv { /// Grow the vector to be able to store `size` bits without resizing. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -634,7 +634,7 @@ impl Bitv { /// Return the capacity in bits for this bit vector. Inserting any /// element less than this amount will not trigger a resizing. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -650,7 +650,7 @@ impl Bitv { /// Grow the `Bitv` in-place. Add `n` copies of `value` to the `Bitv`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -691,11 +691,11 @@ impl Bitv { /// Shorten by one and return the removed element. /// - /// # Failure + /// ## Failure /// /// Assert if empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::bitv; @@ -718,7 +718,7 @@ impl Bitv { /// Push a `bool` onto the end. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::Bitv; @@ -742,7 +742,7 @@ impl Bitv { /// with the most significant bits of each byte coming first. Each /// bit becomes `true` if equal to 1 or `false` if equal to 0. /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::bitv; @@ -764,7 +764,7 @@ pub fn from_bytes(bytes: &[u8]) -> Bitv { /// Create a `Bitv` of the specified length where the value at each /// index is `f(index)`. /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::bitv::from_fn; @@ -937,7 +937,7 @@ impl<'a> RandomAccessIterator for Bits<'a> { /// set of objects is proportional to the maximum of the objects when viewed /// as a `uint`. /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::{BitvSet, Bitv}; @@ -981,7 +981,7 @@ impl Default for BitvSet { impl BitvSet { /// Create a new bit vector set with initially no contents. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -995,7 +995,7 @@ impl BitvSet { /// Create a new bit vector set with initially no contents, able to /// hold `nbits` elements without resizing. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1009,7 +1009,7 @@ impl BitvSet { /// Create a new bit vector set from the given bit vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::{bitv, BitvSet}; @@ -1030,7 +1030,7 @@ impl BitvSet { /// Returns the capacity in bits for this bit vector. Inserting any /// element less than this amount will not trigger a resizing. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1046,7 +1046,7 @@ impl BitvSet { /// Grows the underlying vector to be able to store `size` bits. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1062,7 +1062,7 @@ impl BitvSet { /// Consume this set to return the underlying bit vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1082,7 +1082,7 @@ impl BitvSet { /// Return a reference to the underlying bit vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1101,7 +1101,7 @@ impl BitvSet { /// Return a mutable reference to the underlying bit vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1139,7 +1139,7 @@ impl BitvSet { /// Truncate the underlying vector to the least length required. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1170,7 +1170,7 @@ impl BitvSet { /// Iterator over each uint stored in the BitvSet. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1191,7 +1191,7 @@ impl BitvSet { /// Iterator over each uint stored in `self` union `other`. /// See [union_with](#method.union_with) for an efficient in-place version. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1219,7 +1219,7 @@ impl BitvSet { /// Iterator over each uint stored in `self` intersect `other`. /// See [intersect_with](#method.intersect_with) for an efficient in-place version. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1248,7 +1248,7 @@ impl BitvSet { /// Iterator over each uint stored in the `self` setminus `other`. /// See [difference_with](#method.difference_with) for an efficient in-place version. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1284,7 +1284,7 @@ impl BitvSet { /// See [symmetric_difference_with](#method.symmetric_difference_with) for /// an efficient in-place version. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1311,7 +1311,7 @@ impl BitvSet { /// Union in-place with the specified other bit vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1334,7 +1334,7 @@ impl BitvSet { /// Intersect in-place with the specified other bit vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1357,7 +1357,7 @@ impl BitvSet { /// Difference in-place with the specified other bit vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; @@ -1387,7 +1387,7 @@ impl BitvSet { /// Symmetric difference in-place with the specified other bit vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::BitvSet; diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index 68b6416b69bf5..f266183e5953a 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -276,7 +276,7 @@ impl DList { /// /// If the list is empty, do nothing. /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::DList; @@ -303,7 +303,7 @@ impl DList { /// /// If the list is empty, do nothing. /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::DList; @@ -330,7 +330,7 @@ impl DList { /// /// O(1) /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::DList; @@ -371,7 +371,7 @@ impl DList { /// /// O(1) /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::DList; @@ -400,7 +400,7 @@ impl DList { /// /// O(N) /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::DList; diff --git a/src/libcollections/hash/mod.rs b/src/libcollections/hash/mod.rs index 6f8b63953e2b4..d47eb54f9b7d9 100644 --- a/src/libcollections/hash/mod.rs +++ b/src/libcollections/hash/mod.rs @@ -14,7 +14,7 @@ * This module provides a generic way to compute the hash of a value. The * simplest way to make a type hashable is to use `#[deriving(Hash)]`: * - * # Example + * ## Example * * ```rust * use std::hash; diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index d2d8ad696d7c5..a3266776128cc 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -74,7 +74,7 @@ mod deque; pub trait Mutable: Collection { /// Clear the container, removing all values. /// - /// # Example + /// ## Example /// /// ``` /// let mut v = vec![1i, 2, 3]; @@ -89,7 +89,7 @@ pub trait Mutable: Collection { pub trait Map: Collection { /// Return a reference to the value corresponding to the key. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -103,7 +103,7 @@ pub trait Map: Collection { /// Return true if the map contains a value for the specified key. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -125,7 +125,7 @@ pub trait MutableMap: Map + Mutable { /// key is replaced by the new value. Return true if the key did /// not already exist in the map. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -143,7 +143,7 @@ pub trait MutableMap: Map + Mutable { /// Remove a key-value pair from the map. Return true if the key /// was present in the map, otherwise false. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -161,7 +161,7 @@ pub trait MutableMap: Map + Mutable { /// Insert a key-value pair from the map. If the key already had a value /// present in the map, that value is returned. Otherwise None is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -179,7 +179,7 @@ pub trait MutableMap: Map + Mutable { /// Removes a key from the map, returning the value at the key if the key /// was previously in the map. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -193,7 +193,7 @@ pub trait MutableMap: Map + Mutable { /// Return a mutable reference to the value corresponding to the key. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -215,7 +215,7 @@ pub trait MutableMap: Map + Mutable { pub trait Set: Collection { /// Return true if the set contains a value. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -229,7 +229,7 @@ pub trait Set: Collection { /// Return true if the set has no elements in common with `other`. /// This is equivalent to checking for an empty intersection. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -247,7 +247,7 @@ pub trait Set: Collection { /// Return true if the set is a subset of another. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -265,7 +265,7 @@ pub trait Set: Collection { /// Return true if the set is a superset of another. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -295,7 +295,7 @@ pub trait MutableSet: Set + Mutable { /// Add a value to the set. Return true if the value was not already /// present in the set. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -311,7 +311,7 @@ pub trait MutableSet: Set + Mutable { /// Remove a value from the set. Return true if the value was /// present in the set. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -328,7 +328,7 @@ pub trait MutableSet: Set + Mutable { pub trait MutableSeq: Mutable { /// Append an element to the back of a collection. /// - /// # Example + /// ## Example /// /// ```rust /// let mut vec = vec!(1i, 2); @@ -339,7 +339,7 @@ pub trait MutableSeq: Mutable { /// Remove the last element from a collection and return it, or `None` if it is /// empty. /// - /// # Example + /// ## Example /// /// ```rust /// let mut vec = vec!(1i, 2, 3); @@ -352,7 +352,7 @@ pub trait MutableSeq: Mutable { /// A double-ended sequence that allows querying, insertion and deletion at both /// ends. /// -/// # Example +/// ## Example /// /// With a `Deque` we can simulate a queue efficiently: /// @@ -412,7 +412,7 @@ pub trait Deque : MutableSeq { /// Provide a reference to the front element, or `None` if the sequence is /// empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::{RingBuf, Deque}; @@ -429,7 +429,7 @@ pub trait Deque : MutableSeq { /// Provide a mutable reference to the front element, or `None` if the /// sequence is empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::{RingBuf, Deque}; @@ -450,7 +450,7 @@ pub trait Deque : MutableSeq { /// Provide a reference to the back element, or `None` if the sequence is /// empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::{DList, Deque}; @@ -467,7 +467,7 @@ pub trait Deque : MutableSeq { /// Provide a mutable reference to the back element, or `None` if the sequence /// is empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::{DList, Deque}; @@ -487,7 +487,7 @@ pub trait Deque : MutableSeq { /// Insert an element first in the sequence. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::{DList, Deque}; @@ -501,7 +501,7 @@ pub trait Deque : MutableSeq { /// Insert an element last in the sequence. /// - /// # Example + /// ## Example /// /// ```ignore /// use std::collections::{DList, Deque}; @@ -516,7 +516,7 @@ pub trait Deque : MutableSeq { /// Remove the last element and return it, or `None` if the sequence is empty. /// - /// # Example + /// ## Example /// /// ```ignore /// use std::collections::{RingBuf, Deque}; @@ -534,7 +534,7 @@ pub trait Deque : MutableSeq { /// Remove the first element and return it, or `None` if the sequence is empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::{RingBuf, Deque}; diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs index f76fae39f3426..14a037dc71ec8 100644 --- a/src/libcollections/priority_queue.rs +++ b/src/libcollections/priority_queue.rs @@ -10,7 +10,7 @@ //! A priority queue implemented with a binary heap. //! -//! # Example +//! ## Example //! //! This is a larger example which implements [Dijkstra's algorithm][dijkstra] //! to solve the [shortest path problem][sssp] on a [directed graph][dir_graph]. @@ -184,7 +184,7 @@ impl Default for PriorityQueue { impl PriorityQueue { /// Create an empty PriorityQueue as a max-heap. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -197,7 +197,7 @@ impl PriorityQueue { /// so that the PriorityQueue does not have to be reallocated /// until it contains at least that many values. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -210,7 +210,7 @@ impl PriorityQueue { /// Create a PriorityQueue from a vector. This is sometimes called /// `heapifying` the vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -229,7 +229,7 @@ impl PriorityQueue { /// An iterator visiting all values in underlying vector, in /// arbitrary order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -246,7 +246,7 @@ impl PriorityQueue { /// Returns the greatest item in a queue or `None` if it is empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -269,7 +269,7 @@ impl PriorityQueue { /// Returns the number of elements the queue can hold without reallocating. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -282,7 +282,7 @@ impl PriorityQueue { /// Reserve capacity for exactly `n` elements in the PriorityQueue. /// Do nothing if the capacity is already sufficient. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -296,7 +296,7 @@ impl PriorityQueue { /// Reserve capacity for at least `n` elements in the PriorityQueue. /// Do nothing if the capacity is already sufficient. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -312,7 +312,7 @@ impl PriorityQueue { /// Remove the greatest item from a queue and return it, or `None` if it is /// empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -341,7 +341,7 @@ impl PriorityQueue { /// Push an item onto the queue. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -362,7 +362,7 @@ impl PriorityQueue { /// Optimized version of a push followed by a pop. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -387,7 +387,7 @@ impl PriorityQueue { /// Optimized version of a pop followed by a push. The push is done /// regardless of whether the queue is empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -421,7 +421,7 @@ impl PriorityQueue { /// Consume the PriorityQueue and return the underlying vector /// in arbitrary order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; @@ -439,7 +439,7 @@ impl PriorityQueue { /// Consume the PriorityQueue and return a vector in sorted /// (ascending) order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::PriorityQueue; diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs index 44b546f665688..e4284a3ce91ea 100644 --- a/src/libcollections/ringbuf.rs +++ b/src/libcollections/ringbuf.rs @@ -136,7 +136,7 @@ impl RingBuf { /// /// Fails if there is no element with the given index /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::RingBuf; @@ -159,7 +159,7 @@ impl RingBuf { /// /// Fails if there is no element with the given index /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::RingBuf; @@ -185,7 +185,7 @@ impl RingBuf { /// /// Fails if there is no element with the given index /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::RingBuf; @@ -215,7 +215,7 @@ impl RingBuf { /// doing nothing if `self`'s capacity is already equal to or greater /// than the requested capacity /// - /// # Arguments + /// ## Arguments /// /// * n - The number of elements to reserve space for pub fn reserve_exact(&mut self, n: uint) { @@ -229,7 +229,7 @@ impl RingBuf { /// Do nothing if `self`'s capacity is already equal to or greater /// than the requested capacity. /// - /// # Arguments + /// ## Arguments /// /// * n - The number of elements to reserve space for pub fn reserve(&mut self, n: uint) { @@ -238,7 +238,7 @@ impl RingBuf { /// Front-to-back iterator. /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::RingBuf; @@ -255,7 +255,7 @@ impl RingBuf { /// Front-to-back iterator which returns mutable values. /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::RingBuf; diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 64062dc0ccbf8..a3a758e413b14 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -555,7 +555,7 @@ pub trait MutableVectorAllocating<'a, T> { /// This sort is `O(n log n)` worst-case and stable, but allocates /// approximately `2 * n`, where `n` is the length of `self`. /// - /// # Example + /// ## Example /// /// ```rust /// let mut v = [5i, 4, 1, 3, 2]; @@ -575,7 +575,7 @@ pub trait MutableVectorAllocating<'a, T> { * Returns the number of elements copied (the shorter of self.len() * and end - start). * - * # Arguments + * ## Arguments * * * src - A mutable vector of `T` * * start - The index into `src` to start copying from @@ -606,7 +606,7 @@ pub trait MutableOrdVector { /// /// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`. /// - /// # Example + /// ## Example /// /// ```rust /// let mut v = [-5i, 4, 1, -3, 2]; @@ -620,7 +620,7 @@ pub trait MutableOrdVector { /// /// Returns `true` if successful, `false` if the slice is at the last-ordered permutation. /// - /// # Example + /// ## Example /// /// ```rust /// let v = &mut [0i, 1, 2]; @@ -635,7 +635,7 @@ pub trait MutableOrdVector { /// /// Returns `true` if successful, `false` if the slice is at the first-ordered permutation. /// - /// # Example + /// ## Example /// /// ```rust /// let v = &mut [1i, 0, 2]; diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs index f567c5777b171..58e3166f2d1da 100644 --- a/src/libcollections/smallintmap.rs +++ b/src/libcollections/smallintmap.rs @@ -29,7 +29,7 @@ use hash::Hash; /// A map optimized for small integer keys. /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::SmallIntMap; @@ -178,7 +178,7 @@ impl > Hash for SmallIntMap { impl SmallIntMap { /// Create an empty SmallIntMap. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::SmallIntMap; @@ -189,7 +189,7 @@ impl SmallIntMap { /// Create an empty SmallIntMap with space for at least `capacity` elements /// before resizing. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::SmallIntMap; @@ -202,11 +202,11 @@ impl SmallIntMap { /// Retrieves a value for the given key. /// See [`find`](../trait.Map.html#tymethod.find) for a non-failing alternative. /// - /// # Failure + /// ## Failure /// /// Fails if the key is not present. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::SmallIntMap; @@ -234,7 +234,7 @@ impl SmallIntMap { /// An iterator visiting all key-value pairs in ascending order by the keys. /// Iterator element type is `(uint, &'r V)`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::SmallIntMap; @@ -261,7 +261,7 @@ impl SmallIntMap { /// with mutable references to the values /// Iterator element type is `(uint, &'r mut V)`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::SmallIntMap; @@ -289,7 +289,7 @@ impl SmallIntMap { /// Empties the map, moving all values into the specified closure. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::SmallIntMap; @@ -321,7 +321,7 @@ impl SmallIntMap { /// Otherwise set the value to `newval`. /// Return `true` if the key did not already exist in the map. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::SmallIntMap; @@ -345,7 +345,7 @@ impl SmallIntMap { /// Otherwise set the value to `newval`. /// Return `true` if the key did not already exist in the map. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::SmallIntMap; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index f013557f9a532..8aacf54d0bed1 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -125,7 +125,7 @@ pub fn from_chars(chs: &[char]) -> String { pub trait StrVector { /// Concatenate a vector of strings. /// - /// # Example + /// ## Example /// /// ```rust /// let first = "Restaurant at the End of the".to_string(); @@ -137,7 +137,7 @@ pub trait StrVector { /// Concatenate a vector of strings, placing a given separator between each. /// - /// # Example + /// ## Example /// /// ```rust /// let first = "Roast".to_string(); @@ -304,17 +304,17 @@ impl<'a> Iterator for Decompositions<'a> { /// Replace all occurrences of one string with another /// -/// # Arguments +/// ## Arguments /// /// * s - The string containing substrings to replace /// * from - The string to replace /// * to - The replacement string /// -/// # Return value +/// ## Return value /// /// The original string with all occurrences of `from` replaced with `to` /// -/// # Example +/// ## Example /// /// ```rust /// use std::str; @@ -388,7 +388,7 @@ pub type SendStr = MaybeOwned<'static>; impl<'a> MaybeOwned<'a> { /// Returns `true` if this `MaybeOwned` wraps an owned string /// - /// # Example + /// ## Example /// /// ```rust /// let string = String::from_str("orange"); @@ -405,7 +405,7 @@ impl<'a> MaybeOwned<'a> { /// Returns `true` if this `MaybeOwned` wraps a borrowed string /// - /// # Example + /// ## Example /// /// ```rust /// let string = "orange"; @@ -427,7 +427,7 @@ pub trait IntoMaybeOwned<'a> { fn into_maybe_owned(self) -> MaybeOwned<'a>; } -/// # Example +/// ## Example /// /// ```rust /// let owned_string = String::from_str("orange"); @@ -441,7 +441,7 @@ impl<'a> IntoMaybeOwned<'a> for String { } } -/// # Example +/// ## Example /// /// ```rust /// let string = "orange"; @@ -453,7 +453,7 @@ impl<'a> IntoMaybeOwned<'a> for &'a str { fn into_maybe_owned(self) -> MaybeOwned<'a> { Slice(self) } } -/// # Example +/// ## Example /// /// ```rust /// let str = "orange"; @@ -626,16 +626,16 @@ pub trait StrAllocating: Str { /// Replace all occurrences of one string with another. /// - /// # Arguments + /// ## Arguments /// /// * `from` - The string to replace /// * `to` - The replacement string /// - /// # Return value + /// ## Return value /// /// The original string with all occurrences of `from` replaced with `to`. /// - /// # Example + /// ## Example /// /// ```rust /// let s = "Do you know the muffin man, diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index e5c2d98519163..52c13480dcb18 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -35,7 +35,7 @@ pub struct String { impl String { /// Creates a new string buffer initialized with the empty string. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::new(); @@ -51,7 +51,7 @@ impl String { /// The string will be able to hold exactly `capacity` bytes without /// reallocating. If `capacity` is 0, the string will not allocate. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::with_capacity(10); @@ -65,7 +65,7 @@ impl String { /// Creates a new string buffer from the given string. /// - /// # Example + /// ## Example /// /// ``` /// let s = String::from_str("hello"); @@ -98,7 +98,7 @@ impl String { /// Returns `Err` with the original vector if the vector contains invalid /// UTF-8. /// - /// # Example + /// ## Example /// /// ```rust /// let hello_vec = vec![104, 101, 108, 108, 111]; @@ -121,7 +121,7 @@ impl String { /// Converts a vector of bytes to a new utf-8 string. /// Any invalid utf-8 sequences are replaced with U+FFFD REPLACEMENT CHARACTER. /// - /// # Example + /// ## Example /// /// ```rust /// let input = b"Hello \xF0\x90\x80World"; @@ -247,7 +247,7 @@ impl String { /// Decode a UTF-16 encoded vector `v` into a `String`, returning `None` /// if `v` contains any invalid data. /// - /// # Example + /// ## Example /// /// ```rust /// // 𝄞music @@ -273,7 +273,7 @@ impl String { /// Decode a UTF-16 encoded vector `v` into a string, replacing /// invalid data with the replacement character (U+FFFD). /// - /// # Example + /// ## Example /// ```rust /// // 𝄞music /// let v = [0xD834, 0xDD1E, 0x006d, 0x0075, @@ -289,7 +289,7 @@ impl String { /// Convert a vector of chars to a string. /// - /// # Example + /// ## Example /// /// ```rust /// let chars = ['h', 'e', 'l', 'l', 'o']; @@ -303,7 +303,7 @@ impl String { /// Return the underlying byte buffer, encoded as UTF-8. /// - /// # Example + /// ## Example /// /// ``` /// let s = String::from_str("hello"); @@ -318,7 +318,7 @@ impl String { /// Pushes the given string onto this buffer; then, returns `self` so that it can be used /// again. /// - /// # Example + /// ## Example /// /// ``` /// let s = String::from_str("hello"); @@ -335,7 +335,7 @@ impl String { /// Creates a string buffer by repeating a character `length` times. /// - /// # Example + /// ## Example /// /// ``` /// let s = String::from_char(5, 'a'); @@ -359,11 +359,11 @@ impl String { /// Convert a byte to a UTF-8 string. /// - /// # Failure + /// ## Failure /// /// Fails if invalid UTF-8 /// - /// # Example + /// ## Example /// /// ```rust /// let s = String::from_byte(104); @@ -376,7 +376,7 @@ impl String { /// Pushes the given string onto this string buffer. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("foo"); @@ -390,7 +390,7 @@ impl String { /// Push `ch` onto the given string `count` times. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("foo"); @@ -406,7 +406,7 @@ impl String { /// Returns the number of bytes that this string buffer can hold without reallocating. /// - /// # Example + /// ## Example /// /// ``` /// let s = String::with_capacity(10); @@ -419,7 +419,7 @@ impl String { /// Reserves capacity for at least `extra` additional bytes in this string buffer. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::with_capacity(10); @@ -434,7 +434,7 @@ impl String { /// Reserves capacity for at least `capacity` bytes in this string buffer. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::new(); @@ -448,7 +448,7 @@ impl String { /// Reserves capacity for exactly `capacity` bytes in this string buffer. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::new(); @@ -462,7 +462,7 @@ impl String { /// Shrinks the capacity of this string buffer to match its length. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("foo"); @@ -478,7 +478,7 @@ impl String { /// Adds the given character to the end of the string. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("abc"); @@ -509,7 +509,7 @@ impl String { /// This is unsafe because it does not check /// to ensure that the resulting string will be valid UTF-8. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::new(); @@ -525,7 +525,7 @@ impl String { /// Works with the underlying buffer as a byte slice. /// - /// # Example + /// ## Example /// /// ``` /// let s = String::from_str("hello"); @@ -541,7 +541,7 @@ impl String { /// This is unsafe because it does not check /// to ensure that the resulting string will be valid UTF-8. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("hello"); @@ -560,11 +560,11 @@ impl String { /// Shorten a string to the specified length. /// - /// # Failure + /// ## Failure /// /// Fails if `len` > current length. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("hello"); @@ -582,7 +582,7 @@ impl String { /// This is unsafe because it does not check /// to ensure that the resulting string will be valid UTF-8. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("hell"); @@ -602,7 +602,7 @@ impl String { /// This is unsafe because it does not check /// to ensure that the resulting string will be valid UTF-8. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("foo"); @@ -628,7 +628,7 @@ impl String { /// Removes the last character from the string buffer and returns it. /// Returns `None` if this string buffer is empty. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("foo"); @@ -657,7 +657,7 @@ impl String { /// This is unsafe because it does not check /// to ensure that the resulting string will be valid UTF-8. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("foo"); @@ -675,11 +675,11 @@ impl String { /// Removes the first character from the string buffer and returns it. /// Returns `None` if this string buffer is empty. /// - /// # Warning + /// ## Warning /// /// This is a O(n) operation as it requires copying every element in the buffer. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("foo"); @@ -708,7 +708,7 @@ impl String { /// This is unsafe because it does not check /// to ensure that the resulting string will be valid UTF-8. /// - /// # Example + /// ## Example /// /// ``` /// let mut s = String::from_str("hello"); diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs index 5de23b42f5c7d..4b5ac9248c3ad 100644 --- a/src/libcollections/treemap.rs +++ b/src/libcollections/treemap.rs @@ -48,7 +48,7 @@ use vec::Vec; /// as a right child. The time complexity is the same, and re-balancing /// operations are more frequent but also cheaper. /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -240,7 +240,7 @@ impl Default for TreeMap { impl TreeMap { /// Create an empty `TreeMap`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -250,7 +250,7 @@ impl TreeMap { /// Get a lazy iterator over the keys in the map, in ascending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -271,7 +271,7 @@ impl TreeMap { /// Get a lazy iterator over the values in the map, in ascending order /// with respect to the corresponding keys. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -291,7 +291,7 @@ impl TreeMap { /// Get a lazy iterator over the key-value pairs in the map, in ascending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -316,7 +316,7 @@ impl TreeMap { /// Get a lazy reverse iterator over the key-value pairs in the map, in descending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -337,7 +337,7 @@ impl TreeMap { /// Get a lazy forward iterator over the key-value pairs in the /// map, with the values being mutable. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -367,7 +367,7 @@ impl TreeMap { /// Get a lazy reverse iterator over the key-value pairs in the /// map, with the values being mutable. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -394,7 +394,7 @@ impl TreeMap { /// Get a lazy iterator that consumes the treemap, it is not usable /// after calling this. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -425,7 +425,7 @@ impl TreeMap { /// with current key and guides tree navigation. That means `f` should /// be aware of natural ordering of the tree. /// - /// # Example + /// ## Example /// /// ``` /// use collections::treemap::TreeMap; @@ -454,7 +454,7 @@ impl TreeMap { /// with current key and guides tree navigation. That means `f` should /// be aware of natural ordering of the tree. /// - /// # Example + /// ## Example /// /// ``` /// let mut t = collections::treemap::TreeMap::new(); @@ -524,7 +524,7 @@ impl TreeMap { /// Return a lazy iterator to the first key-value pair whose key is not less than `k` /// If all keys in map are less than `k` an empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -546,7 +546,7 @@ impl TreeMap { /// Return a lazy iterator to the first key-value pair whose key is greater than `k` /// If all keys in map are less than or equal to `k` an empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -582,7 +582,7 @@ impl TreeMap { /// If all keys in map are less than `k` an empty iterator is /// returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -616,7 +616,7 @@ impl TreeMap { /// If all keys in map are less than or equal to `k` an empty iterator /// is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeMap; @@ -1091,7 +1091,7 @@ impl Default for TreeSet { impl TreeSet { /// Create an empty `TreeSet`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1102,7 +1102,7 @@ impl TreeSet { /// Get a lazy iterator over the values in the set, in ascending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1120,7 +1120,7 @@ impl TreeSet { /// Get a lazy iterator over the values in the set, in descending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1139,7 +1139,7 @@ impl TreeSet { /// Creates a consuming iterator, that is, one that moves each value out of the /// set in ascending order. The set cannot be used after calling this. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1157,7 +1157,7 @@ impl TreeSet { /// Get a lazy iterator pointing to the first value not less than `v` (greater or equal). /// If all elements in the set are less than `v` empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1176,7 +1176,7 @@ impl TreeSet { /// If all elements in the set are less than or equal to `v` an /// empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1193,7 +1193,7 @@ impl TreeSet { /// Visit the values representing the difference, in ascending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1220,7 +1220,7 @@ impl TreeSet { /// Visit the values representing the symmetric difference, in ascending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1246,7 +1246,7 @@ impl TreeSet { /// Visit the values representing the intersection, in ascending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; @@ -1269,7 +1269,7 @@ impl TreeSet { /// Visit the values representing the union, in ascending order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TreeSet; diff --git a/src/libcollections/trie.rs b/src/libcollections/trie.rs index cd011b0e01339..77d147cbdcf16 100644 --- a/src/libcollections/trie.rs +++ b/src/libcollections/trie.rs @@ -42,7 +42,7 @@ enum Child { /// A map implemented as a radix trie. /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -194,7 +194,7 @@ impl Default for TrieMap { impl TrieMap { /// Create an empty TrieMap. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -208,7 +208,7 @@ impl TrieMap { /// Visit all key-value pairs in reverse order. Abort traversal when f returns false. /// Return true if f returns true for all elements. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -242,7 +242,7 @@ impl TrieMap { /// Get an iterator over the key-value pairs in the map, ordered by keys. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -265,7 +265,7 @@ impl TrieMap { /// Get an iterator over the key-value pairs in the map, with the /// ability to mutate the values. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -315,7 +315,7 @@ macro_rules! bound { // there's no 0-or-1 repeats yet. mutability = $($mut_:tt)*) => { { - // # For `mut` + // ## For `mut` // We need an unsafe pointer here because we are borrowing // mutable references to the internals of each of these // mutable nodes, while still using the outer node. @@ -327,7 +327,7 @@ macro_rules! bound { // iterator), i.e. we can never cause a deallocation of any // TrieNodes so the raw pointer is always valid. // - // # For non-`mut` + // ## For non-`mut` // We like sharing code so much that even a little unsafe won't // stop us. let this = $this; @@ -388,7 +388,7 @@ impl TrieMap { /// Get an iterator pointing to the first key-value pair whose key is not less than `key`. /// If all keys in the map are less than `key` an empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -405,7 +405,7 @@ impl TrieMap { /// Get an iterator pointing to the first key-value pair whose key is greater than `key`. /// If all keys in the map are not greater than `key` an empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -430,7 +430,7 @@ impl TrieMap { /// Get an iterator pointing to the first key-value pair whose key is not less than `key`. /// If all keys in the map are less than `key` an empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -455,7 +455,7 @@ impl TrieMap { /// Get an iterator pointing to the first key-value pair whose key is greater than `key`. /// If all keys in the map are not greater than `key` an empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieMap; @@ -504,7 +504,7 @@ impl> Hash for TrieMap { /// A set implemented as a radix trie. /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::TrieSet; @@ -603,7 +603,7 @@ impl Default for TrieSet { impl TrieSet { /// Create an empty TrieSet. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieSet; @@ -617,7 +617,7 @@ impl TrieSet { /// Visit all values in reverse order. Abort traversal when `f` returns false. /// Return `true` if `f` returns `true` for all elements. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieSet; @@ -640,7 +640,7 @@ impl TrieSet { /// Get an iterator over the values in the set, in sorted order. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieSet; @@ -664,7 +664,7 @@ impl TrieSet { /// Get an iterator pointing to the first value that is not less than `val`. /// If all values in the set are less than `val` an empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieSet; @@ -681,7 +681,7 @@ impl TrieSet { /// Get an iterator pointing to the first value that key is greater than `val`. /// If all values in the set are less than or equal to `val` an empty iterator is returned. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::TrieSet; diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index dcee92f6dbced..25836c4114c11 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -33,7 +33,7 @@ pub static PTR_MARKER: u8 = 0; /// An owned, growable vector. /// -/// # Examples +/// ## Examples /// /// ``` /// let mut vec = Vec::new(); @@ -84,7 +84,7 @@ pub static PTR_MARKER: u8 = 0; /// } /// ``` /// -/// # Capacity and reallocation +/// ## Capacity and reallocation /// /// The capacity of a vector is the amount of space allocated for any future /// elements that will be added onto the vector. This is not to be confused @@ -112,7 +112,7 @@ impl Vec { /// /// The vector will not allocate until elements are pushed onto it. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec: Vec = Vec::new(); @@ -137,7 +137,7 @@ impl Vec { /// the main `Vec` docs above, 'Capacity and reallocation'.) To create /// a vector of a given length, use `Vec::from_elem` or `Vec::from_fn`. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec: Vec = Vec::with_capacity(10); @@ -172,7 +172,7 @@ impl Vec { /// Creates a `Vec` of size `length` and initializes the elements to the /// value returned by the closure `op`. /// - /// # Example + /// ## Example /// /// ``` /// let vec = Vec::from_fn(3, |idx| idx * 2); @@ -201,7 +201,7 @@ impl Vec { /// beginning of that allocation /// - `ptr` must be allocated by the default `Vec` allocator /// - /// # Example + /// ## Example /// /// ``` /// use std::ptr; @@ -242,7 +242,7 @@ impl Vec { /// satisfy `f` and all elements of `B` do not. The order of elements is /// preserved. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2i, 3i, 4i]; @@ -271,7 +271,7 @@ impl Vec { /// Iterates over the `second` vector, copying each element and appending it to /// the `first`. Afterwards, the `first` is then returned for use again. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2i]; @@ -286,7 +286,7 @@ impl Vec { /// Constructs a `Vec` by cloning elements of a slice. /// - /// # Example + /// ## Example /// /// ``` /// let slice = [1i, 2, 3]; @@ -303,7 +303,7 @@ impl Vec { /// /// Creates a `Vec` with `length` copies of `value`. /// - /// # Example + /// ## Example /// ``` /// let vec = Vec::from_elem(3, "hi"); /// println!("{}", vec); // prints [hi, hi, hi] @@ -327,7 +327,7 @@ impl Vec { /// Iterates over the slice `other`, clones each element, and then appends /// it to this `Vec`. The `other` vector is traversed in-order. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i]; @@ -357,7 +357,7 @@ impl Vec { /// /// Adds `n` copies of `value` to the `Vec`. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec!["hello"]; @@ -381,7 +381,7 @@ impl Vec { /// end of the vector, expands the vector by replicating `initval` to fill /// the intervening space. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec!["a", "b", "c"]; @@ -403,7 +403,7 @@ impl Vec { /// `(A,B)`, where all elements of `A` satisfy `f` and all elements of `B` /// do not. The order of elements is preserved. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3, 4]; @@ -553,7 +553,7 @@ impl Vec { /// Returns the number of elements the vector can hold without /// reallocating. /// - /// # Example + /// ## Example /// /// ``` /// let vec: Vec = Vec::with_capacity(10); @@ -567,11 +567,11 @@ impl Vec { /// Reserves capacity for at least `n` additional elements in the given /// vector. /// - /// # Failure + /// ## Failure /// /// Fails if the new capacity overflows `uint`. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec: Vec = vec![1i]; @@ -596,7 +596,7 @@ impl Vec { /// If the capacity for `self` is already equal to or greater than the /// requested capacity, then no action is taken. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3]; @@ -614,7 +614,7 @@ impl Vec { /// If the capacity for `self` is already equal to or greater than the /// requested capacity, then no action is taken. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec: Vec = Vec::with_capacity(10); @@ -637,7 +637,7 @@ impl Vec { /// Shrink the capacity of the vector as much as possible /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3]; @@ -669,7 +669,7 @@ impl Vec { /// Appends one element to the vector provided. The vector itself is then /// returned for use again. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2]; @@ -687,7 +687,7 @@ impl Vec { /// If `len` is greater than the vector's current length, this has no /// effect. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3, 4]; @@ -708,7 +708,7 @@ impl Vec { /// Work with `self` as a mutable slice. /// - /// # Example + /// ## Example /// /// ``` /// fn foo(slice: &mut [int]) {} @@ -730,7 +730,7 @@ impl Vec { /// value out of the vector (from start to end). The vector cannot /// be used after calling this. /// - /// # Example + /// ## Example /// /// ``` /// let v = vec!["a".to_string(), "b".to_string()]; @@ -757,7 +757,7 @@ impl Vec { /// modifying its buffers, so it is up to the caller to ensure that the /// vector is actually the specified size. /// - /// # Example + /// ## Example /// /// ``` /// let mut v = vec![1u, 2, 3, 4]; @@ -772,11 +772,11 @@ impl Vec { /// Returns a reference to the value at index `index`. /// - /// # Failure + /// ## Failure /// /// Fails if `index` is out of bounds /// - /// # Example + /// ## Example /// /// ``` /// #![allow(deprecated)] @@ -792,11 +792,11 @@ impl Vec { /// Returns a mutable reference to the value at index `index`. /// - /// # Failure + /// ## Failure /// /// Fails if `index` is out of bounds /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3]; @@ -811,7 +811,7 @@ impl Vec { /// Returns an iterator over references to the elements of the vector in /// order. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3]; @@ -828,7 +828,7 @@ impl Vec { /// Returns an iterator over mutable references to the elements of the /// vector in order. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3]; @@ -846,7 +846,7 @@ impl Vec { /// This sort is `O(n log n)` worst-case and stable, but allocates /// approximately `2 * n`, where `n` is the length of `self`. /// - /// # Example + /// ## Example /// /// ``` /// let mut v = vec![5i, 4, 1, 3, 2]; @@ -864,12 +864,12 @@ impl Vec { /// Returns a slice of self spanning the interval [`start`, `end`). /// - /// # Failure + /// ## Failure /// /// Fails when the slice (or part of it) is outside the bounds of self, or when /// `start` > `end`. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3, 4]; @@ -882,11 +882,11 @@ impl Vec { /// Returns a slice containing all but the first element of the vector. /// - /// # Failure + /// ## Failure /// /// Fails when the vector is empty. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3]; @@ -899,11 +899,11 @@ impl Vec { /// Returns all but the first `n' elements of a vector. /// - /// # Failure + /// ## Failure /// /// Fails when there are fewer than `n` elements in the vector. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3, 4]; @@ -917,7 +917,7 @@ impl Vec { /// Returns a reference to the last element of a vector, or `None` if it is /// empty. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3]; @@ -931,7 +931,7 @@ impl Vec { /// Returns a mutable reference to the last element of a vector, or `None` /// if it is empty. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3]; @@ -948,7 +948,8 @@ impl Vec { /// /// Returns `None` if `index` is out of bounds. /// - /// # Example + /// ## Example + /// /// ``` /// let mut v = vec!["foo".to_string(), "bar".to_string(), /// "baz".to_string(), "qux".to_string()]; @@ -974,12 +975,12 @@ impl Vec { /// Prepend an element to the vector. /// - /// # Warning + /// ## Warning /// /// This is an O(n) operation as it requires copying every element in the /// vector. /// - /// # Example + /// ## Example /// /// ```ignore /// let mut vec = vec![1i, 2, 3]; @@ -995,12 +996,12 @@ impl Vec { /// Removes the first element from a vector and returns it, or `None` if /// the vector is empty. /// - /// # Warning + /// ## Warning /// /// This is an O(n) operation as it requires copying every element in the /// vector. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3]; @@ -1016,12 +1017,12 @@ impl Vec { /// Insert an element at position `index` within the vector, shifting all /// elements after position i one position to the right. /// - /// # Failure + /// ## Failure /// /// Fails if `index` is not between `0` and the vector's length (both /// bounds inclusive). /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3]; @@ -1055,7 +1056,7 @@ impl Vec { /// shifting all elements after position `index` one position to the left. /// Returns `None` if `i` is out of bounds. /// - /// # Example + /// ## Example /// /// ``` /// let mut v = vec![1i, 2, 3]; @@ -1094,7 +1095,7 @@ impl Vec { /// illegal to use the `other` vector after calling this method /// (because it is moved here). /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![box 1i]; @@ -1108,12 +1109,12 @@ impl Vec { /// Returns a mutable slice of `self` between `start` and `end`. /// - /// # Failure + /// ## Failure /// /// Fails when `start` or `end` point outside the bounds of `self`, or when /// `start` > `end`. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3, 4]; @@ -1127,11 +1128,11 @@ impl Vec { /// Returns a mutable slice of self from `start` to the end of the vec. /// - /// # Failure + /// ## Failure /// /// Fails when `start` points outside the bounds of self. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3, 4]; @@ -1144,11 +1145,11 @@ impl Vec { /// Returns a mutable slice of self from the start of the vec to `end`. /// - /// # Failure + /// ## Failure /// /// Fails when `end` points outside the bounds of self. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3, 4]; @@ -1165,11 +1166,11 @@ impl Vec { /// the index `mid` itself) and the second will contain all /// indices from `[mid, len)` (excluding the index `len` itself). /// - /// # Failure + /// ## Failure /// /// Fails if `mid > len`. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3, 4, 5, 6]; @@ -1200,7 +1201,7 @@ impl Vec { /// Reverse the order of elements in a vector, in place. /// - /// # Example + /// ## Example /// /// ``` /// let mut v = vec![1i, 2, 3]; @@ -1214,11 +1215,11 @@ impl Vec { /// Returns a slice of `self` from `start` to the end of the vec. /// - /// # Failure + /// ## Failure /// /// Fails when `start` points outside the bounds of self. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3]; @@ -1231,11 +1232,11 @@ impl Vec { /// Returns a slice of self from the start of the vec to `end`. /// - /// # Failure + /// ## Failure /// /// Fails when `end` points outside the bounds of self. /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3, 4]; @@ -1248,11 +1249,11 @@ impl Vec { /// Returns a slice containing all but the last element of the vector. /// - /// # Failure + /// ## Failure /// /// Fails if the vector is empty /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3]; @@ -1272,7 +1273,7 @@ impl Vec { /// Modifying the vector may cause its buffer to be reallocated, which /// would also make any pointers to it invalid. /// - /// # Example + /// ## Example /// /// ``` /// let v = vec![1i, 2, 3]; @@ -1297,7 +1298,7 @@ impl Vec { /// Modifying the vector may cause its buffer to be reallocated, which /// would also make any pointers to it invalid. /// - /// # Example + /// ## Example /// /// ``` /// use std::ptr; @@ -1320,7 +1321,7 @@ impl Vec { /// In other words, remove all elements `e` such that `f(&e)` returns false. /// This method operates in place and preserves the order the retained elements. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 3, 4]; @@ -1351,7 +1352,7 @@ impl Vec { /// The vector is grown by `n` elements. The i-th new element are initialized to the value /// returned by `f(i)` where `i` is in the range [0, n). /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![0u, 1]; @@ -1372,7 +1373,7 @@ impl Vec { /// This sort is `O(n log n)` worst-case and stable, but allocates /// approximately `2 * n`, where `n` is the length of `self`. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![3i, 1, 2]; @@ -1394,7 +1395,7 @@ impl Mutable for Vec { impl Vec { /// Return true if a vector contains an element with the given value /// - /// # Example + /// ## Example /// /// ``` /// let vec = vec![1i, 2, 3]; @@ -1409,7 +1410,7 @@ impl Vec { /// /// If the vector is sorted, this removes all duplicates. /// - /// # Example + /// ## Example /// /// ``` /// let mut vec = vec![1i, 2, 2, 3, 2]; @@ -1504,7 +1505,7 @@ impl Vec { impl Vector for Vec { /// Work with `self` as a slice. /// - /// # Example + /// ## Example /// /// ``` /// fn foo(slice: &[int]) {} @@ -1559,11 +1560,11 @@ impl fmt::Show for Vec { impl MutableSeq for Vec { /// Append an element to the back of a collection. /// - /// # Failure + /// ## Failure /// /// Fails if the number of elements in the vector overflows a `uint`. /// - /// # Example + /// ## Example /// /// ```rust /// let mut vec = vec!(1i, 2); diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 1809988847bc7..b7bc4dbf7ba18 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -24,7 +24,7 @@ //! Note that &Any is limited to testing whether a value is of a specified //! concrete type, and cannot be used to test whether a type implements a trait. //! -//! # Examples +//! ## Examples //! //! Consider a situation where we want to log out a value passed to a function. //! We know the value we're working on implements Show, but we don't know its diff --git a/src/libcore/atomics.rs b/src/libcore/atomics.rs index 466a1738e8288..4de1a90b12faa 100644 --- a/src/libcore/atomics.rs +++ b/src/libcore/atomics.rs @@ -116,7 +116,7 @@ impl AtomicBool { /// replace the current value with `new`. Return the previous value. /// If the return value is equal to `old` then the value was updated. /// - /// # Examples + /// ## Examples /// /// ```rust /// use std::sync::Arc; @@ -167,7 +167,7 @@ impl AtomicBool { /// argument `val`, and sets the new value to the result. /// Returns the previous value. /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicBool, SeqCst}; @@ -197,7 +197,7 @@ impl AtomicBool { /// argument `val`, and sets the new value to the result. /// Returns the previous value. /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicBool, SeqCst}; @@ -228,7 +228,7 @@ impl AtomicBool { /// argument `val`, and sets the new value to the result. /// Returns the previous value. /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicBool, SeqCst}; @@ -258,7 +258,7 @@ impl AtomicBool { /// argument `val`, and sets the new value to the result. /// Returns the previous value. /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicBool, SeqCst}; @@ -319,7 +319,7 @@ impl AtomicInt { /// Add to the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicInt, SeqCst}; @@ -335,7 +335,7 @@ impl AtomicInt { /// Subtract from the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicInt, SeqCst}; @@ -351,7 +351,7 @@ impl AtomicInt { /// Bitwise and with the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicUint, SeqCst}; @@ -366,7 +366,7 @@ impl AtomicInt { /// Bitwise or with the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicUint, SeqCst}; @@ -381,7 +381,7 @@ impl AtomicInt { /// Bitwise xor with the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicUint, SeqCst}; @@ -431,7 +431,7 @@ impl AtomicUint { /// Add to the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicUint, SeqCst}; @@ -447,7 +447,7 @@ impl AtomicUint { /// Subtract from the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicUint, SeqCst}; @@ -463,7 +463,7 @@ impl AtomicUint { /// Bitwise and with the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicUint, SeqCst}; @@ -478,7 +478,7 @@ impl AtomicUint { /// Bitwise or with the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicUint, SeqCst}; @@ -493,7 +493,7 @@ impl AtomicUint { /// Bitwise xor with the current value, returning the previous /// - /// # Examples + /// ## Examples /// /// ``` /// use std::sync::atomics::{AtomicUint, SeqCst}; @@ -675,7 +675,7 @@ unsafe fn atomic_xor(dst: *mut T, val: T, order: Ordering) -> T { /// /// Accepts `Acquire`, `Release`, `AcqRel` and `SeqCst` orderings. /// -/// # Failure +/// ## Failure /// /// Fails if `order` is `Relaxed` #[inline] diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 24ea3480c4397..6b7d95b4bf808 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -33,7 +33,7 @@ //! already mutably borrowed; when this happens it results in task //! failure. //! -//! # When to choose interior mutability +//! ## When to choose interior mutability //! //! The more common inherited mutability, where one must have unique //! access to mutate a value, is one of the key language elements that @@ -263,7 +263,7 @@ impl RefCell { /// The borrow lasts until the returned `Ref` exits scope. Multiple /// immutable borrows can be taken out at the same time. /// - /// # Failure + /// ## Failure /// /// Fails if the value is currently mutably borrowed. #[unstable] @@ -296,7 +296,7 @@ impl RefCell { /// The borrow lasts until the returned `RefMut` exits scope. The value /// cannot be borrowed while this borrow is active. /// - /// # Failure + /// ## Failure /// /// Fails if the value is currently borrowed. #[unstable] @@ -422,7 +422,7 @@ impl<'b, T> DerefMut for RefMut<'b, T> { /// `UnsafeCell` doesn't opt-out from any kind, instead, types with an /// `UnsafeCell` interior are expected to opt-out from kinds themselves. /// -/// # Example: +/// ## Example: /// /// ```rust /// use std::cell::UnsafeCell; diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 26baf96a8bc86..c2174dadc891d 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -85,16 +85,16 @@ pub fn from_u32(i: u32) -> Option { /// Compared to `is_digit()`, this function only recognizes the /// characters `0-9`, `a-z` and `A-Z`. /// -/// # Return value +/// ## Return value /// /// Returns `true` if `c` is a valid digit under `radix`, and `false` /// otherwise. /// -/// # Failure +/// ## Failure /// /// Fails if given a `radix` > 36. /// -/// # Note +/// ## Note /// /// This just wraps `to_digit()`. /// @@ -109,14 +109,14 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool { /// /// Converts a `char` to the corresponding digit /// -/// # Return value +/// ## Return value /// /// If `c` is between '0' and '9', the corresponding value /// between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is /// 'b' or 'B', 11, etc. Returns none if the `char` does not /// refer to a digit in the given radix. /// -/// # Failure +/// ## Failure /// /// Fails if given a `radix` outside the range `[0..36]`. /// @@ -138,12 +138,12 @@ pub fn to_digit(c: char, radix: uint) -> Option { /// /// Converts a number to the character representing it /// -/// # Return value +/// ## Return value /// /// Returns `Some(char)` if `num` represents one digit under `radix`, /// using one character of `0-9` or `a-z`, or `None` if it doesn't. /// -/// # Failure +/// ## Failure /// /// Fails if given an `radix` > 36. /// @@ -238,37 +238,37 @@ pub trait Char { /// Compared to `is_digit()`, this function only recognizes the characters /// `0-9`, `a-z` and `A-Z`. /// - /// # Return value + /// ## Return value /// /// Returns `true` if `c` is a valid digit under `radix`, and `false` /// otherwise. /// - /// # Failure + /// ## Failure /// /// Fails if given a radix > 36. fn is_digit_radix(&self, radix: uint) -> bool; /// Converts a character to the corresponding digit. /// - /// # Return value + /// ## Return value /// /// If `c` is between '0' and '9', the corresponding value between 0 and /// 9. If `c` is 'a' or 'A', 10. If `c` is 'b' or 'B', 11, etc. Returns /// none if the character does not refer to a digit in the given radix. /// - /// # Failure + /// ## Failure /// /// Fails if given a radix outside the range [0..36]. fn to_digit(&self, radix: uint) -> Option; /// Converts a number to the character representing it. /// - /// # Return value + /// ## Return value /// /// Returns `Some(char)` if `num` represents one digit under `radix`, /// using one character of `0-9` or `a-z`, or `None` if it doesn't. /// - /// # Failure + /// ## Failure /// /// Fails if given a radix > 36. fn from_digit(num: uint, radix: uint) -> Option; diff --git a/src/libcore/collections.rs b/src/libcore/collections.rs index 7d87e03c13410..b128d08c98a72 100644 --- a/src/libcore/collections.rs +++ b/src/libcore/collections.rs @@ -15,7 +15,7 @@ pub trait Collection { /// Return the number of elements in the container /// - /// # Example + /// ## Example /// /// ``` /// let a = [1i, 2, 3]; @@ -25,7 +25,7 @@ pub trait Collection { /// Return true if the container contains no elements /// - /// # Example + /// ## Example /// /// ``` /// let s = String::new(); diff --git a/src/libcore/default.rs b/src/libcore/default.rs index 4de2384d23dc3..214f856b6f658 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -16,7 +16,7 @@ pub trait Default { /// Return the "default value" for a type. /// - /// # Example + /// ## Example /// /// ``` /// use std::default::Default; diff --git a/src/libcore/finally.rs b/src/libcore/finally.rs index 514b3f90df7c0..e11bd1a22ddbe 100644 --- a/src/libcore/finally.rs +++ b/src/libcore/finally.rs @@ -72,7 +72,7 @@ impl Finally for fn() -> T { * function could have failed at any point, so the values of the shared * state may be inconsistent. * - * # Example + * ## Example * * ``` * use std::finally::try_finally; diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 386fc28119a3e..d051cba115349 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -76,7 +76,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; * This is meant to be a common base implementation for all numeric string * conversion functions like `to_string()` or `to_str_radix()`. * - * # Arguments + * ## Arguments * - `num` - The number to convert. Accepts any number that * implements the numeric traits. * - `radix` - Base to use. Accepts only the values 2-36. If the exponential notation @@ -94,7 +94,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; * - `f` - A closure to invoke with the bytes representing the * float. * - * # Failure + * ## Failure * - Fails if `radix` < 2 or `radix` > 36. * - Fails if `radix` > 14 and `exp_format` is `ExpDec` due to conflict * between digit and exponent sign `'e'`. diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 5277b473828fc..b20566af6b9f1 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -66,7 +66,7 @@ pub trait FormatWriter { /// written, and this method will not return until all data has been /// written or an error occurs. /// - /// # Errors + /// ## Errors /// /// This function will return an instance of `FormatError` on error. fn write(&mut self, bytes: &[u8]) -> Result; @@ -260,7 +260,7 @@ uniform_fn_call_workaround! { /// and a list of arguments. The arguments will be formatted according to the /// specified format string into the output stream provided. /// -/// # Arguments +/// ## Arguments /// /// * output - the buffer to write output to /// * args - the precompiled arguments generated by `format_args!` @@ -332,7 +332,7 @@ impl<'a> Formatter<'a> { /// emitted into a byte-array. The byte-array should *not* contain the sign /// for the integer, that will be added by this method. /// - /// # Arguments + /// ## Arguments /// /// * is_positive - whether the original integer was positive or not. /// * prefix - if the '#' character (FlagAlternate) is provided, this diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 2ed32b3388f17..9ec49fa79e244 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -141,7 +141,7 @@ pub struct RadixFmt(T, R); /// Constructs a radix formatter in the range of `2..36`. /// -/// # Example +/// ## Example /// /// ~~~ /// use std::fmt::radix; diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 002babf7df976..2123cba61f322 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -300,7 +300,7 @@ extern "rust-intrinsic" { /// Both types must have the same size and alignment, and this guarantee /// is enforced at compile-time. /// - /// # Example + /// ## Example /// /// ```rust /// use std::mem; @@ -333,7 +333,7 @@ extern "rust-intrinsic" { /// /// `copy_nonoverlapping_memory` is semantically equivalent to C's `memcpy`. /// - /// # Example + /// ## Example /// /// A safe swap function: /// @@ -358,7 +358,7 @@ extern "rust-intrinsic" { /// } /// ``` /// - /// # Safety Note + /// ## Safety Note /// /// If the source and destination overlap then the behavior of this /// function is undefined. @@ -372,7 +372,7 @@ extern "rust-intrinsic" { /// /// `copy_memory` is semantically equivalent to C's `memmove`. /// - /// # Example + /// ## Example /// /// Efficiently create a Rust vector from an unsafe buffer: /// diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index b0660230c2ce6..28b8887e16ccc 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -111,7 +111,7 @@ pub trait Iterator { /// finish iterating over the current iterator, and then it will iterate /// over the other specified iterator. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [0i]; @@ -131,7 +131,7 @@ pub trait Iterator { /// either iterator returns None, all further invocations of next() will /// return None. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [0i]; @@ -149,7 +149,7 @@ pub trait Iterator { /// Creates a new iterator which will apply the specified function to each /// element returned by the first, yielding the mapped element instead. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2]; @@ -167,7 +167,7 @@ pub trait Iterator { /// by this iterator. Only elements which have the predicate evaluate to /// `true` will be yielded. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2]; @@ -184,7 +184,7 @@ pub trait Iterator { /// If the specified function returns None, the element is skipped. /// Otherwise the option is unwrapped and the new value is yielded. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2]; @@ -200,7 +200,7 @@ pub trait Iterator { /// Creates an iterator which yields a pair of the value returned by this /// iterator plus the current index of iteration. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [100i, 200]; @@ -219,7 +219,7 @@ pub trait Iterator { /// Creates an iterator that has a `.peek()` method /// that returns an optional reference to the next element. /// - /// # Example + /// ## Example /// /// ```rust /// let xs = [100i, 200, 300]; @@ -242,7 +242,7 @@ pub trait Iterator { /// returns false. Once the predicate returns false, all further elements are /// yielded. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 2, 1]; @@ -261,7 +261,7 @@ pub trait Iterator { /// returns true. After the predicate returns false for the first time, no /// further elements will be yielded. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 2, 1]; @@ -278,7 +278,7 @@ pub trait Iterator { /// Creates an iterator which skips the first `n` elements of this iterator, /// and then it yields all further items. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -295,7 +295,7 @@ pub trait Iterator { /// Creates an iterator which yields the first `n` elements of this /// iterator, and then it will always return None. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -315,7 +315,7 @@ pub trait Iterator { /// mutated as necessary. The yielded values from the closure are yielded /// from the Scan instance when not None. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -339,7 +339,7 @@ pub trait Iterator { /// Creates an iterator that maps each element to an iterator, /// and yields the elements of the produced iterators /// - /// # Example + /// ## Example /// /// ```rust /// use std::iter::count; @@ -364,7 +364,7 @@ pub trait Iterator { /// iterator yields `None`. Random-access iterator behavior is not /// affected, only single and double-ended iterator behavior. /// - /// # Example + /// ## Example /// /// ```rust /// fn process>(it: U) -> int { @@ -394,7 +394,7 @@ pub trait Iterator { /// element before yielding it. This is often useful for debugging an /// iterator pipeline. /// - /// # Example + /// ## Example /// /// ```rust /// use std::iter::AdditiveIterator; @@ -418,7 +418,7 @@ pub trait Iterator { /// This is useful to allow applying iterator adaptors while still /// retaining ownership of the original iterator value. /// - /// # Example + /// ## Example /// /// ```rust /// let mut xs = range(0u, 10); @@ -435,7 +435,7 @@ pub trait Iterator { /// Apply a function to each element, or stop iterating if the /// function returns `false`. /// - /// # Example + /// ## Example /// /// ```rust,ignore /// range(0u, 5).advance(|x| {print!("{} ", x); true}); @@ -456,7 +456,7 @@ pub trait Iterator { /// Loops through the entire iterator, collecting all of the elements into /// a container implementing `FromIterator`. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -471,7 +471,7 @@ pub trait Iterator { /// Loops through `n` iterations, returning the `n`th element of the /// iterator. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -493,7 +493,7 @@ pub trait Iterator { /// Loops through the entire iterator, returning the last element of the /// iterator. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -509,7 +509,7 @@ pub trait Iterator { /// Performs a fold operation over the entire iterator, returning the /// eventual state at the end of the iteration. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -529,7 +529,7 @@ pub trait Iterator { /// Counts the number of elements in this iterator. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -544,7 +544,7 @@ pub trait Iterator { /// Tests whether the predicate holds true for all elements in the iterator. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -560,7 +560,7 @@ pub trait Iterator { /// Tests whether any element of an iterator satisfies the specified /// predicate. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -599,7 +599,7 @@ pub trait Iterator { /// Return the element that gives the maximum value from the /// specified function. /// - /// # Example + /// ## Example /// /// ```rust /// let xs = [-3i, 0, 1, 5, -10]; @@ -623,7 +623,7 @@ pub trait Iterator { /// Return the element that gives the minimum value from the /// specified function. /// - /// # Example + /// ## Example /// /// ```rust /// let xs = [-3i, 0, 1, 5, -10]; @@ -809,7 +809,7 @@ impl<'a, A, T: DoubleEndedIterator> DoubleEndedIterator for ByRef<'a, T> { pub trait AdditiveIterator { /// Iterates over the entire iterator, summing up all the elements /// - /// # Example + /// ## Example /// /// ```rust /// use std::iter::AdditiveIterator; @@ -834,7 +834,7 @@ impl + Zero, T: Iterator> AdditiveIterator for T { pub trait MultiplicativeIterator { /// Iterates over the entire iterator, multiplying all the elements /// - /// # Example + /// ## Example /// /// ```rust /// use std::iter::{count, MultiplicativeIterator}; @@ -862,7 +862,7 @@ impl + One, T: Iterator> MultiplicativeIterator for T { pub trait OrdIterator { /// Consumes the entire iterator to return the maximum element. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -872,7 +872,7 @@ pub trait OrdIterator { /// Consumes the entire iterator to return the minimum element. /// - /// # Example + /// ## Example /// /// ```rust /// let a = [1i, 2, 3, 4, 5]; @@ -893,7 +893,7 @@ pub trait OrdIterator { /// On an iterator of length `n`, `min_max` does `1.5 * n` comparisons, /// and so faster than calling `min` and `max separately which does `2 * n` comparisons. /// - /// # Example + /// ## Example /// /// ```rust /// use std::iter::{NoElements, OneElement, MinMax}; @@ -1000,7 +1000,7 @@ impl MinMaxResult { /// `Some(x,y)` is returned where `x <= y`. If `MinMaxResult` has variant `OneElement(x)`, /// performing this operation will make one clone of `x`. /// - /// # Example + /// ## Example /// /// ```rust /// use std::iter::{NoElements, OneElement, MinMax, MinMaxResult}; @@ -1027,7 +1027,7 @@ impl MinMaxResult { pub trait CloneableIterator { /// Repeats an iterator endlessly /// - /// # Example + /// ## Example /// /// ```rust /// use std::iter::{CloneableIterator, count}; @@ -1973,7 +1973,7 @@ pub struct Range { /// Returns an iterator over the given range [start, stop) (that is, starting /// at start (inclusive), and ending at stop (exclusive)). /// -/// # Example +/// ## Example /// /// ```rust /// let array = [0, 1, 2, 3, 4]; diff --git a/src/libcore/kinds.rs b/src/libcore/kinds.rs index f6a88b3419607..9005b32777d95 100644 --- a/src/libcore/kinds.rs +++ b/src/libcore/kinds.rs @@ -106,7 +106,7 @@ pub mod marker { /// *Note:* It is very unusual to have to add a covariant constraint. /// If you are not sure, you probably want to use `InvariantType`. /// - /// # Example + /// ## Example /// /// Given a struct `S` that includes a type parameter `T` /// but does not actually *reference* that type parameter: @@ -147,7 +147,7 @@ pub mod marker { /// *Note:* It is very unusual to have to add a contravariant constraint. /// If you are not sure, you probably want to use `InvariantType`. /// - /// # Example + /// ## Example /// /// Given a struct `S` that includes a type parameter `T` /// but does not actually *reference* that type parameter: @@ -187,7 +187,7 @@ pub mod marker { /// For more information about variance, refer to this Wikipedia /// article . /// - /// # Example + /// ## Example /// /// The Cell type is an example which uses unsafe code to achieve /// "interior" mutability: diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 2809bda4f6ed6..2cc8645ec2c96 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! # The Rust Core Library +//! ## The Rust Core Library //! //! The Rust Core Library is the dependency-free foundation of [The //! Rust Standard Library](../std/index.html). It is the portable glue @@ -26,7 +26,7 @@ //! subject to change over time; only the interface exposed through libstd is //! intended to be stable. //! -//! # How to use the core library +//! ## How to use the core library //! // FIXME: Fill me in with more detail when the interface settles //! This library is built on the assumption of a few existing symbols: diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 06e28816c1cd5..36872162c578d 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -319,7 +319,7 @@ pub fn replace(dest: &mut T, mut src: T) -> T { /// This function can be used to destroy any value by allowing `drop` to take /// ownership of its argument. /// -/// # Example +/// ## Example /// /// ``` /// use std::cell::RefCell; diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 48a3db4258f2b..eaaf86674f921 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -51,7 +51,7 @@ pub fn div_rem + Rem>(x: T, y: T) -> (T, T) { /// Defines an additive identity element for `Self`. /// -/// # Deriving +/// ## Deriving /// /// This trait can be automatically be derived using `#[deriving(Zero)]` /// attribute. If you choose to use this, make sure that the laws outlined in @@ -59,14 +59,14 @@ pub fn div_rem + Rem>(x: T, y: T) -> (T, T) { pub trait Zero: Add { /// Returns the additive identity element of `Self`, `0`. /// - /// # Laws + /// ## Laws /// /// ~~~text /// a + 0 = a ∀ a ∈ Self /// 0 + a = a ∀ a ∈ Self /// ~~~ /// - /// # Purity + /// ## Purity /// /// This function should return the same result at all times regardless of /// external mutable state, for example values stored in TLS or in @@ -112,14 +112,14 @@ zero_impl!(f64, 0.0f64) pub trait One: Mul { /// Returns the multiplicative identity element of `Self`, `1`. /// - /// # Laws + /// ## Laws /// /// ~~~text /// a * 1 = a ∀ a ∈ Self /// 1 * a = a ∀ a ∈ Self /// ~~~ /// - /// # Purity + /// ## Purity /// /// This function should return the same result at all times regardless of /// external mutable state, for example values stored in TLS or in @@ -241,7 +241,7 @@ macro_rules! signed_float_impl( unsafe { $fdim(*self, *other) } } - /// # Returns + /// ## Returns /// /// - `1.0` if the number is positive, `+0.0` or `INFINITY` /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` @@ -308,7 +308,7 @@ trait_impl!(Unsigned for uint u8 u16 u32 u64) /// Raises a value to the power of exp, using exponentiation by squaring. /// -/// # Example +/// ## Example /// /// ```rust /// use std::num; @@ -395,7 +395,7 @@ pub trait Int: Primitive + Shr { /// Returns the number of ones in the binary representation of the integer. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0b01001100u8; @@ -406,7 +406,7 @@ pub trait Int: Primitive /// Returns the number of zeros in the binary representation of the integer. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0b01001100u8; @@ -421,7 +421,7 @@ pub trait Int: Primitive /// Returns the number of leading zeros in the in the binary representation /// of the integer. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0b0101000u16; @@ -433,7 +433,7 @@ pub trait Int: Primitive /// Returns the number of trailing zeros in the in the binary representation /// of the integer. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0b0101000u16; @@ -445,7 +445,7 @@ pub trait Int: Primitive /// Shifts the bits to the left by a specified amount amount, `n`, wrapping /// the truncated bits to the end of the resulting integer. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0x0123456789ABCDEFu64; @@ -458,7 +458,7 @@ pub trait Int: Primitive /// Shifts the bits to the right by a specified amount amount, `n`, wrapping /// the truncated bits to the beginning of the resulting integer. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0x0123456789ABCDEFu64; @@ -470,7 +470,7 @@ pub trait Int: Primitive /// Reverses the byte order of the integer. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0x0123456789ABCDEFu64; @@ -484,7 +484,7 @@ pub trait Int: Primitive /// /// On big endian this is a no-op. On little endian the bytes are swapped. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0x0123456789ABCDEFu64; @@ -504,7 +504,7 @@ pub trait Int: Primitive /// /// On little endian this is a no-op. On big endian the bytes are swapped. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0x0123456789ABCDEFu64; @@ -524,7 +524,7 @@ pub trait Int: Primitive /// /// On big endian this is a no-op. On little endian the bytes are swapped. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0x0123456789ABCDEFu64; @@ -544,7 +544,7 @@ pub trait Int: Primitive /// /// On little endian this is a no-op. On big endian the bytes are swapped. /// - /// # Example + /// ## Example /// /// ```rust /// let n = 0x0123456789ABCDEFu64; @@ -1130,7 +1130,7 @@ impl_from_primitive!(f64, to_f64) /// Cast from one machine scalar to another. /// -/// # Example +/// ## Example /// /// ``` /// use std::num; @@ -1218,7 +1218,7 @@ impl Saturating for T pub trait CheckedAdd: Add { /// Adds two numbers, checking for overflow. If overflow happens, `None` is returned. /// - /// # Example + /// ## Example /// /// ```rust /// use std::num::CheckedAdd; @@ -1279,7 +1279,7 @@ checked_impl!(CheckedAdd, checked_add, i64, intrinsics::i64_add_with_overflow) pub trait CheckedSub: Sub { /// Subtracts two numbers, checking for underflow. If underflow happens, `None` is returned. /// - /// # Example + /// ## Example /// /// ```rust /// use std::num::CheckedSub; @@ -1315,7 +1315,7 @@ pub trait CheckedMul: Mul { /// Multiplies two numbers, checking for underflow or overflow. If underflow or overflow /// happens, `None` is returned. /// - /// # Example + /// ## Example /// /// ```rust /// use std::num::CheckedMul; @@ -1350,7 +1350,7 @@ pub trait CheckedDiv: Div { /// Divides two numbers, checking for underflow or overflow. If underflow or overflow happens, /// `None` is returned. /// - /// # Example + /// ## Example /// /// ```rust /// use std::num::CheckedDiv; diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 839243970ac67..4c1aaf6eac222 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -21,7 +21,7 @@ * All of these traits are imported by the prelude, so they are available in * every Rust program. * - * # Example + * ## Example * * This example creates a `Point` struct that implements `Add` and `Sub`, and then * demonstrates adding and subtracting two `Point`s. @@ -60,7 +60,7 @@ * The `Drop` trait is used to run some code when a value goes out of scope. This * is sometimes called a 'destructor'. * - * # Example + * ## Example * * A trivial implementation of `Drop`. The `drop` method is called when `_x` goes * out of scope, and therefore `main` prints `Dropping!`. @@ -89,7 +89,7 @@ pub trait Drop { * * The `Add` trait is used to specify the functionality of `+`. * - * # Example + * ## Example * * A trivial implementation of `Add`. When `Foo + Foo` happens, it ends up * calling `add`, and therefore, `main` prints `Adding!`. @@ -130,7 +130,7 @@ add_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64) * * The `Sub` trait is used to specify the functionality of `-`. * - * # Example + * ## Example * * A trivial implementation of `Sub`. When `Foo - Foo` happens, it ends up * calling `sub`, and therefore, `main` prints `Subtracting!`. @@ -171,7 +171,7 @@ sub_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64) * * The `Mul` trait is used to specify the functionality of `*`. * - * # Example + * ## Example * * A trivial implementation of `Mul`. When `Foo * Foo` happens, it ends up * calling `mul`, and therefore, `main` prints `Multiplying!`. @@ -212,7 +212,7 @@ mul_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64) * * The `Div` trait is used to specify the functionality of `/`. * - * # Example + * ## Example * * A trivial implementation of `Div`. When `Foo / Foo` happens, it ends up * calling `div`, and therefore, `main` prints `Dividing!`. @@ -253,7 +253,7 @@ div_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64) * * The `Rem` trait is used to specify the functionality of `%`. * - * # Example + * ## Example * * A trivial implementation of `Rem`. When `Foo % Foo` happens, it ends up * calling `rem`, and therefore, `main` prints `Remainder-ing!`. @@ -308,7 +308,7 @@ rem_float_impl!(f64, fmod) * * The `Neg` trait is used to specify the functionality of unary `-`. * - * # Example + * ## Example * * A trivial implementation of `Neg`. When `-Foo` happens, it ends up calling * `neg`, and therefore, `main` prints `Negating!`. @@ -365,7 +365,7 @@ neg_uint_impl!(u64, i64) * * The `Not` trait is used to specify the functionality of unary `!`. * - * # Example + * ## Example * * A trivial implementation of `Not`. When `!Foo` happens, it ends up calling * `not`, and therefore, `main` prints `Not-ing!`. @@ -407,7 +407,7 @@ not_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64) * * The `BitAnd` trait is used to specify the functionality of `&`. * - * # Example + * ## Example * * A trivial implementation of `BitAnd`. When `Foo & Foo` happens, it ends up * calling `bitand`, and therefore, `main` prints `Bitwise And-ing!`. @@ -448,7 +448,7 @@ bitand_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64) * * The `BitOr` trait is used to specify the functionality of `|`. * - * # Example + * ## Example * * A trivial implementation of `BitOr`. When `Foo | Foo` happens, it ends up * calling `bitor`, and therefore, `main` prints `Bitwise Or-ing!`. @@ -489,7 +489,7 @@ bitor_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64) * * The `BitXor` trait is used to specify the functionality of `^`. * - * # Example + * ## Example * * A trivial implementation of `BitXor`. When `Foo ^ Foo` happens, it ends up * calling `bitxor`, and therefore, `main` prints `Bitwise Xor-ing!`. @@ -530,7 +530,7 @@ bitxor_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64) * * The `Shl` trait is used to specify the functionality of `<<`. * - * # Example + * ## Example * * A trivial implementation of `Shl`. When `Foo << Foo` happens, it ends up * calling `shl`, and therefore, `main` prints `Shifting left!`. @@ -573,7 +573,7 @@ shl_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64) * * The `Shr` trait is used to specify the functionality of `>>`. * - * # Example + * ## Example * * A trivial implementation of `Shr`. When `Foo >> Foo` happens, it ends up * calling `shr`, and therefore, `main` prints `Shifting right!`. @@ -615,7 +615,7 @@ shr_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64) * The `Index` trait is used to specify the functionality of indexing operations * like `arr[idx]` when used in an immutable context. * - * # Example + * ## Example * * A trivial implementation of `Index`. When `Foo[Foo]` happens, it ends up * calling `index`, and therefore, `main` prints `Indexing!`. @@ -646,7 +646,7 @@ pub trait Index { * The `IndexMut` trait is used to specify the functionality of indexing * operations like `arr[idx]`, when used in a mutable context. * - * # Example + * ## Example * * A trivial implementation of `IndexMut`. When `Foo[Foo]` happens, it ends up * calling `index`, and therefore, `main` prints `Indexing!`. @@ -677,7 +677,7 @@ pub trait IndexMut { * The `Deref` trait is used to specify the functionality of dereferencing * operations like `*v`. * - * # Example + * ## Example * * A struct with a single field which is accessible via dereferencing the * struct. @@ -710,7 +710,7 @@ pub trait Deref { * The `DerefMut` trait is used to specify the functionality of dereferencing * mutably like `*v = 1;` * - * # Example + * ## Example * * A struct with a single field which is modifiable via dereferencing the * struct. diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 84b402a68dd12..a043ae67ea04c 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -53,7 +53,7 @@ // // FIXME: Show how `Option` is used in practice, with lots of methods // -//! # Options and pointers ("nullable" pointers) +//! ## Options and pointers ("nullable" pointers) //! //! Rust's pointer types must always point to a valid location; there are //! no "null" pointers. Instead, Rust has *optional* pointers, like @@ -85,7 +85,7 @@ //! representation of `Option>` a single pointer. Optional pointers //! in Rust are stored as efficiently as any other pointer type. //! -//! # Examples +//! ## Examples //! //! Basic pattern matching on `Option`: //! @@ -191,7 +191,7 @@ impl Option { /// Convert from `Option` to `Option<&T>` /// - /// # Example + /// ## Example /// /// Convert an `Option` into an `Option`, preserving the original. /// The `map` method takes the `self` argument by value, consuming the original, @@ -240,7 +240,7 @@ impl Option { /// Unwraps an option, yielding the content of a `Some` /// - /// # Failure + /// ## Failure /// /// Fails if the value is a `None` with a custom failure message provided by /// `msg`. @@ -254,11 +254,11 @@ impl Option { /// Moves a value out of an option type and returns it, consuming the `Option`. /// - /// # Failure + /// ## Failure /// /// Fails if the self value equals `None`. /// - /// # Safety note + /// ## Safety note /// /// In general, because this function may fail, its use is discouraged. /// Instead, prefer to use pattern matching and handle the `None` @@ -295,7 +295,7 @@ impl Option { /// Maps an `Option` to `Option` by applying a function to a contained value /// - /// # Example + /// ## Example /// /// Convert an `Option` into an `Option`, consuming the original: /// @@ -438,7 +438,7 @@ impl Option { /// The option dance. Moves a value out of an option type and returns it, /// replacing the original with `None`. /// - /// # Failure + /// ## Failure /// /// Fails if the value equals `None`. #[inline] @@ -451,11 +451,11 @@ impl Option { /// Gets an immutable reference to the value inside an option. /// - /// # Failure + /// ## Failure /// /// Fails if the value equals `None` /// - /// # Safety note + /// ## Safety note /// /// In general, because this function may fail, its use is discouraged /// (calling `get` on `None` is akin to dereferencing a null pointer). @@ -471,11 +471,11 @@ impl Option { /// Gets a mutable reference to the value inside an option. /// - /// # Failure + /// ## Failure /// /// Fails if the value equals `None` /// - /// # Safety note + /// ## Safety note /// /// In general, because this function may fail, its use is discouraged /// (calling `get` on `None` is akin to dereferencing a null pointer). @@ -497,7 +497,7 @@ impl Option { /// value, otherwise if `None`, returns the default value for that /// type. /// - /// # Example + /// ## Example /// /// Convert a string to an integer, turning poorly-formed strings /// into 0 (the default value for integers). `from_str` converts diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index d27689eeaf417..8ac70e70f880d 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -18,7 +18,7 @@ //! There is no method to automatically inject this prelude, and this prelude is //! a subset of the standard library's prelude. //! -//! # Example +//! ## Example //! //! ```ignore //! # fn main() { diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 4921802ba732e..6497b784efabe 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -23,7 +23,7 @@ //! work everywhere. The `RawPtr` also defines the `offset` method, //! for pointer math. //! -//! # Common ways to create unsafe pointers +//! ## Common ways to create unsafe pointers //! //! ## 1. Coerce a reference (`&T`) or mutable reference (`&mut T`). //! @@ -104,7 +104,7 @@ pub use intrinsics::set_memory; /// Create a null pointer. /// -/// # Example +/// ## Example /// /// ``` /// use std::ptr; @@ -118,7 +118,7 @@ pub fn null() -> *const T { 0 as *const T } /// Create an unsafe mutable null pointer. /// -/// # Example +/// ## Example /// /// ``` /// use std::ptr; @@ -222,7 +222,7 @@ pub unsafe fn array_each_with_len(arr: *const *const T, len: uint, /// an array of pointers), iterate through each *const T, /// passing to the provided callback function /// -/// # Safety Note +/// ## Safety Note /// /// This will only work with a null-terminated /// pointer array. @@ -268,7 +268,7 @@ pub trait RawPtr { /// Returns `None` if the pointer is null, or else returns the value wrapped /// in `Some`. /// - /// # Safety Notes + /// ## Safety Notes /// /// While this method is useful for null-safety, it is important to note /// that this is still an unsafe operation because the returned value could diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 980a9c7506f36..de3e59557d735 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -81,7 +81,7 @@ //! let final_awesome_result = good_result.ok().unwrap(); //! ~~~ //! -//! # Results must be used +//! ## Results must be used //! //! A common problem with using return values to indicate errors is //! that it is easy to ignore the return value, thus failing to handle @@ -157,7 +157,7 @@ //! } //! ~~~ //! -//! # The `try!` macro +//! ## The `try!` macro //! //! When writing code that calls many functions that return the //! `Result` type, the error handling can be tedious. The `try!` @@ -228,7 +228,7 @@ //! //! `try!` is imported by the prelude, and is available everywhere. //! -//! # `Result` and `Option` +//! ## `Result` and `Option` //! //! The `Result` and [`Option`](../option/index.html) types are //! similar and complementary: they are often employed to indicate a @@ -250,7 +250,7 @@ //! let mut t = Timer::new().ok().expect("failed to create timer!"); //! ~~~ //! -//! # `Result` vs. `fail!` +//! ## `Result` vs. `fail!` //! //! `Result` is for recoverable errors; `fail!` is for unrecoverable //! errors. Callers should always be able to avoid failure if they @@ -304,7 +304,7 @@ impl Result { /// Returns true if the result is `Ok` /// - /// # Example + /// ## Example /// /// ~~~ /// use std::io::{File, Open, Write}; @@ -324,7 +324,7 @@ impl Result { /// Returns true if the result is `Err` /// - /// # Example + /// ## Example /// /// ~~~ /// use std::io::{File, Open, Read}; @@ -353,7 +353,7 @@ impl Result { /// use `as_ref` to first convert the `Result` into a /// `Result<&T, &E>`. /// - /// # Examples + /// ## Examples /// /// ~~~{.should_fail} /// use std::io::{File, IoResult}; @@ -415,7 +415,7 @@ impl Result { /// /// This function can be used to compose the results of two functions. /// - /// # Examples + /// ## Examples /// /// Sum the lines of a buffer by mapping strings to numbers, /// ignoring I/O and parse errors: @@ -536,7 +536,7 @@ impl Result { impl Result { /// Unwraps a result, yielding the content of an `Ok`. /// - /// # Failure + /// ## Failure /// /// Fails if the value is an `Err`, with a custom failure message provided /// by the `Err`'s value. @@ -553,7 +553,7 @@ impl Result { impl Result { /// Unwraps a result, yielding the content of an `Err`. /// - /// # Failure + /// ## Failure /// /// Fails if the value is an `Ok`, with a custom failure message provided /// by the `Ok`'s value. diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 8197a7c2dcbe2..e360afd9d86c6 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -99,11 +99,11 @@ pub trait ImmutableVector<'a, T> { * `size`. The windows overlap. If the vector is shorter than * `size`, the iterator returns no values. * - * # Failure + * ## Failure * * Fails if `size` is 0. * - * # Example + * ## Example * * Print the adjacent pairs of a vector (i.e. `[1,2]`, `[2,3]`, * `[3,4]`): @@ -124,11 +124,11 @@ pub trait ImmutableVector<'a, T> { * length of the vector, then the last chunk will not have length * `size`. * - * # Failure + * ## Failure * * Fails if `size` is 0. * - * # Example + * ## Example * * Print the vector two elements at a time (i.e. `[1,2]`, * `[3,4]`, `[5]`): @@ -428,7 +428,7 @@ pub trait MutableVector<'a, T> { * length of the vector, then the last chunk will not have length * `size`. * - * # Failure + * ## Failure * * Fails if `size` is 0. */ @@ -474,12 +474,12 @@ pub trait MutableVector<'a, T> { /// /// Fails if `a` or `b` are out of bounds. /// - /// # Arguments + /// ## Arguments /// /// * a - The index of the first element /// * b - The index of the second element /// - /// # Example + /// ## Example /// /// ```rust /// let mut v = ["a", "b", "c", "d"]; @@ -497,7 +497,7 @@ pub trait MutableVector<'a, T> { /// /// Fails if `mid > len`. /// - /// # Example + /// ## Example /// /// ```rust /// let mut v = [1i, 2, 3, 4, 5, 6]; @@ -525,7 +525,7 @@ pub trait MutableVector<'a, T> { /// Reverse the order of elements in a vector, in place. /// - /// # Example + /// ## Example /// /// ```rust /// let mut v = [1i, 2, 3]; @@ -554,7 +554,7 @@ pub trait MutableVector<'a, T> { /// does run the destructor at `index`. It is equivalent to /// `self[index] = val`. /// - /// # Example + /// ## Example /// /// ```rust /// let mut v = ["foo".to_string(), "bar".to_string(), "baz".to_string()]; @@ -574,7 +574,7 @@ pub trait MutableVector<'a, T> { /// old value and hence is only suitable when the vector /// is newly allocated. /// - /// # Example + /// ## Example /// /// ```rust /// let mut v = ["foo".to_string(), "bar".to_string()]; @@ -808,7 +808,7 @@ pub trait MutableCloneableVector { /// shorter of `self.len()` and `src.len()`). Returns the number /// of elements copied. /// - /// # Example + /// ## Example /// /// ```rust /// use std::slice::MutableCloneableVector; diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 2ba51eb98fca0..11df4b51e693f 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -869,7 +869,7 @@ impl<'a> Iterator for Utf16Items<'a> { /// Create an iterator over the UTF-16 encoded codepoints in `v`, /// returning invalid surrogates as `LoneSurrogate`s. /// -/// # Example +/// ## Example /// /// ```rust /// use std::str; @@ -894,7 +894,7 @@ pub fn utf16_items<'a>(v: &'a [u16]) -> Utf16Items<'a> { /// Return a slice of `v` ending at (and not including) the first NUL /// (0). /// -/// # Example +/// ## Example /// /// ```rust /// use std::str; @@ -993,7 +993,7 @@ pub mod raw { /// /// Returns the substring from [`begin`..`end`). /// - /// # Failure + /// ## Failure /// /// If begin is greater than end. /// If end is greater than the length of the string. @@ -1094,14 +1094,14 @@ impl<'a> Collection for &'a str { pub trait StrSlice<'a> { /// Returns true if one string contains another /// - /// # Arguments + /// ## Arguments /// /// - needle - The string to look for fn contains<'a>(&self, needle: &'a str) -> bool; /// Returns true if a string contains a char. /// - /// # Arguments + /// ## Arguments /// /// - needle - The char to look for fn contains_char(&self, needle: char) -> bool; @@ -1109,7 +1109,7 @@ pub trait StrSlice<'a> { /// An iterator over the characters of `self`. Note, this iterates /// over unicode code-points, not unicode graphemes. /// - /// # Example + /// ## Example /// /// ```rust /// let v: Vec = "abc åäö".chars().collect(); @@ -1126,7 +1126,7 @@ pub trait StrSlice<'a> { /// An iterator over substrings of `self`, separated by characters /// matched by `sep`. /// - /// # Example + /// ## Example /// /// ```rust /// let v: Vec<&str> = "Mary had a little lamb".split(' ').collect(); @@ -1147,7 +1147,7 @@ pub trait StrSlice<'a> { /// matched by `sep`, restricted to splitting at most `count` /// times. /// - /// # Example + /// ## Example /// /// ```rust /// let v: Vec<&str> = "Mary had a little lambda".splitn(' ', 2).collect(); @@ -1173,7 +1173,7 @@ pub trait StrSlice<'a> { /// Equivalent to `split`, except that the trailing substring /// is skipped if empty (terminator semantics). /// - /// # Example + /// ## Example /// /// ```rust /// let v: Vec<&str> = "A.B.".split_terminator('.').collect(); @@ -1197,7 +1197,7 @@ pub trait StrSlice<'a> { /// matched by `sep`, starting from the end of the string. /// Restricted to splitting at most `count` times. /// - /// # Example + /// ## Example /// /// ```rust /// let v: Vec<&str> = "Mary had a little lamb".rsplitn(' ', 2).collect(); @@ -1219,7 +1219,7 @@ pub trait StrSlice<'a> { /// `self` that overlap, only the indices corresponding to the /// first match are returned. /// - /// # Example + /// ## Example /// /// ```rust /// let v: Vec<(uint, uint)> = "abcXXXabcYYYabc".match_indices("abc").collect(); @@ -1235,7 +1235,7 @@ pub trait StrSlice<'a> { /// An iterator over the substrings of `self` separated by `sep`. /// - /// # Example + /// ## Example /// /// ```rust /// let v: Vec<&str> = "abcXXXabcYYYabc".split_str("abc").collect(); @@ -1250,7 +1250,7 @@ pub trait StrSlice<'a> { /// by `\n`). This does not include the empty string after a /// trailing `\n`. /// - /// # Example + /// ## Example /// /// ```rust /// let four_lines = "foo\nbar\n\nbaz\n"; @@ -1263,7 +1263,7 @@ pub trait StrSlice<'a> { /// `\n` or `\r\n`. As with `.lines()`, this does not include an /// empty trailing line. /// - /// # Example + /// ## Example /// /// ```rust /// let four_lines = "foo\r\nbar\n\r\nbaz\n"; @@ -1285,7 +1285,7 @@ pub trait StrSlice<'a> { /// /// See also `.len()` for the byte length. /// - /// # Example + /// ## Example /// /// ```rust /// // composed forms of `ö` and `é` @@ -1317,7 +1317,7 @@ pub trait StrSlice<'a> { /// suffixes of strings, and `slice_chars` for slicing based on /// code point counts. /// - /// # Example + /// ## Example /// /// ```rust /// let s = "Löwe 老虎 Léopard"; @@ -1374,7 +1374,7 @@ pub trait StrSlice<'a> { /// Fails if `begin` > `end` or the either `begin` or `end` are /// beyond the last character of the string. /// - /// # Example + /// ## Example /// /// ```rust /// let s = "Löwe 老虎 Léopard"; @@ -1391,11 +1391,11 @@ pub trait StrSlice<'a> { /// Returns a string with characters that match `to_trim` removed. /// - /// # Arguments + /// ## Arguments /// /// * to_trim - a character matcher /// - /// # Example + /// ## Example /// /// ```rust /// assert_eq!("11foo1bar11".trim_chars('1'), "foo1bar") @@ -1406,11 +1406,11 @@ pub trait StrSlice<'a> { /// Returns a string with leading `chars_to_trim` removed. /// - /// # Arguments + /// ## Arguments /// /// * to_trim - a character matcher /// - /// # Example + /// ## Example /// /// ```rust /// assert_eq!("11foo1bar11".trim_left_chars('1'), "foo1bar11") @@ -1421,11 +1421,11 @@ pub trait StrSlice<'a> { /// Returns a string with trailing `chars_to_trim` removed. /// - /// # Arguments + /// ## Arguments /// /// * to_trim - a character matcher /// - /// # Example + /// ## Example /// /// ```rust /// assert_eq!("11foo1bar11".trim_right_chars('1'), "11foo1bar") @@ -1442,7 +1442,7 @@ pub trait StrSlice<'a> { /// /// Fails if `index` is greater than `self.len()`. /// - /// # Example + /// ## Example /// /// ```rust /// let s = "Löwe 老虎 Léopard"; @@ -1465,7 +1465,7 @@ pub trait StrSlice<'a> { /// This function can be used to iterate over the unicode characters of a /// string. /// - /// # Example + /// ## Example /// /// This example manually iterate through the characters of a /// string; this should normally by done by `.chars()` or @@ -1498,17 +1498,17 @@ pub trait StrSlice<'a> { /// 15: m /// ``` /// - /// # Arguments + /// ## Arguments /// /// * s - The string /// * i - The byte offset of the char to extract /// - /// # Return value + /// ## Return value /// /// A record {ch: char, next: uint} containing the char value and the byte /// index of the next unicode character. /// - /// # Failure + /// ## Failure /// /// If `i` is greater than or equal to the length of the string. /// If `i` is not the index of the beginning of a valid UTF-8 character. @@ -1520,7 +1520,7 @@ pub trait StrSlice<'a> { /// /// Returns 0 for next index if called on start index 0. /// - /// # Failure + /// ## Failure /// /// If `i` is greater than the length of the string. /// If `i` is not an index following a valid UTF-8 character. @@ -1528,7 +1528,7 @@ pub trait StrSlice<'a> { /// Plucks the character starting at the `i`th byte of a string. /// - /// # Failure + /// ## Failure /// /// If `i` is greater than or equal to the length of the string. /// If `i` is not the index of the beginning of a valid UTF-8 character. @@ -1536,7 +1536,7 @@ pub trait StrSlice<'a> { /// Plucks the character ending at the `i`th byte of a string. /// - /// # Failure + /// ## Failure /// /// If `i` is greater than the length of the string. /// If `i` is not an index following a valid UTF-8 character. @@ -1548,12 +1548,12 @@ pub trait StrSlice<'a> { /// Returns the byte index of the first character of `self` that /// matches `search`. /// - /// # Return value + /// ## Return value /// /// `Some` containing the byte index of the last matching character /// or `None` if there is no match /// - /// # Example + /// ## Example /// /// ```rust /// let s = "Löwe 老虎 Léopard"; @@ -1572,12 +1572,12 @@ pub trait StrSlice<'a> { /// Returns the byte index of the last character of `self` that /// matches `search`. /// - /// # Return value + /// ## Return value /// /// `Some` containing the byte index of the last matching character /// or `None` if there is no match. /// - /// # Example + /// ## Example /// /// ```rust /// let s = "Löwe 老虎 Léopard"; @@ -1595,16 +1595,16 @@ pub trait StrSlice<'a> { /// Returns the byte index of the first matching substring /// - /// # Arguments + /// ## Arguments /// /// * `needle` - The string to search for /// - /// # Return value + /// ## Return value /// /// `Some` containing the byte index of the first matching substring /// or `None` if there is no match. /// - /// # Example + /// ## Example /// /// ```rust /// let s = "Löwe 老虎 Léopard"; @@ -1620,7 +1620,7 @@ pub trait StrSlice<'a> { /// shifted. If the string does not contain any characters, /// a tuple of None and an empty string is returned instead. /// - /// # Example + /// ## Example /// /// ```rust /// let s = "Löwe 老虎 Léopard"; @@ -1638,7 +1638,7 @@ pub trait StrSlice<'a> { /// /// Fails if `inner` is not a direct slice contained within self. /// - /// # Example + /// ## Example /// /// ```rust /// let string = "a\nb\nc"; diff --git a/src/libcore/tuple/mod.rs b/src/libcore/tuple/mod.rs index ead3564718018..056693ef8b986 100644 --- a/src/libcore/tuple/mod.rs +++ b/src/libcore/tuple/mod.rs @@ -33,7 +33,7 @@ //! * `Ord` //! * `Default` //! -//! # Examples +//! ## Examples //! //! Using methods: //! diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 922bf768854ea..c3979818c4ced 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -25,7 +25,7 @@ //! argument following either a space or an equals sign. Single-character //! options don't require the space. //! -//! # Example +//! ## Example //! //! The following example shows simple command line parsing for an application //! that requires an input file to be specified, accepts an optional output diff --git a/src/libglob/lib.rs b/src/libglob/lib.rs index d539283f0a717..8e61c8c4afd11 100644 --- a/src/libglob/lib.rs +++ b/src/libglob/lib.rs @@ -58,7 +58,7 @@ pub struct Paths { /// `glob_with(pattern, MatchOptions::new())`. Use `glob_with` directly if you /// want to use non-default match options. /// -/// # Example +/// ## Example /// /// Consider a directory `/media/pictures` containing only the files `kittens.jpg`, /// `puppies.jpg` and `hamsters.gif`: @@ -329,7 +329,7 @@ impl Pattern { * Return if the given `str` matches this `Pattern` using the default * match options (i.e. `MatchOptions::new()`). * - * # Example + * ## Example * * ```rust * use glob::Pattern; diff --git a/src/libgreen/lib.rs b/src/libgreen/lib.rs index 6e4e2ac0feee3..b4c3d6a278613 100644 --- a/src/libgreen/lib.rs +++ b/src/libgreen/lib.rs @@ -15,7 +15,7 @@ //! stack-allocation strategy. This can be optionally linked in to rust //! programs in order to provide M:N functionality inside of 1:1 programs. //! -//! # Architecture +//! ## Architecture //! //! An M:N scheduling library implies that there are N OS thread upon which M //! "green threads" are multiplexed. In other words, a set of green threads are @@ -80,7 +80,7 @@ //! stealing simply implies what with M green threads and N schedulers where //! M > N it is very likely that all schedulers will be busy executing work. //! -//! # Considerations when using libgreen +//! ## Considerations when using libgreen //! //! An M:N runtime has both pros and cons, and there is no one answer as to //! whether M:N or 1:1 is appropriate to use. As always, there are many @@ -110,7 +110,7 @@ //! lost cause. These are simply just concerns which should be considered when //! invoking native code. //! -//! # Starting with libgreen +//! ## Starting with libgreen //! //! ```rust //! extern crate green; @@ -128,7 +128,7 @@ //! > **Note**: This `main` function in this example does *not* have I/O //! > support. The basic event loop does not provide any support //! -//! # Starting with I/O support in libgreen +//! ## Starting with I/O support in libgreen //! //! ```rust //! extern crate green; @@ -157,7 +157,7 @@ //! } //! ``` //! -//! # Using a scheduler pool +//! ## Using a scheduler pool //! //! This library adds a `GreenTaskBuilder` trait that extends the methods //! available on `std::task::TaskBuilder` to allow spawning a green task, @@ -255,7 +255,7 @@ pub mod task; /// A helper macro for booting a program with libgreen /// -/// # Example +/// ## Example /// /// ``` /// #![feature(phase)] @@ -285,7 +285,7 @@ macro_rules! green_start( ($f:ident) => ( /// This function will block until the entire pool of M:N schedulers have /// exited. This function also requires a local task to be available. /// -/// # Arguments +/// ## Arguments /// /// * `argc` & `argv` - The argument vector. On Unix this information is used /// by os::args. @@ -294,7 +294,7 @@ macro_rules! green_start( ($f:ident) => ( /// down. The entire pool (and this function) will only return once /// all child tasks have finished executing. /// -/// # Return value +/// ## Return value /// /// The return value is used as the process return code. 0 on success, 101 on /// error. diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs index 38bb6e355a771..6fa755305d7be 100644 --- a/src/libgreen/sched.rs +++ b/src/libgreen/sched.rs @@ -715,7 +715,7 @@ impl Scheduler { /// Block a running task, context switch to the scheduler, then pass the /// blocked task to a closure. /// - /// # Safety note + /// ## Safety note /// /// The closure here is a *stack* closure that lives in the /// running task. It gets transmuted to the scheduler's lifetime diff --git a/src/liblog/macros.rs b/src/liblog/macros.rs index fe74b7d67ffb9..4326883945a43 100644 --- a/src/liblog/macros.rs +++ b/src/liblog/macros.rs @@ -18,7 +18,7 @@ /// format!-based argument list. See documentation in `std::fmt` for details on /// how to use the syntax. /// -/// # Example +/// ## Example /// /// ``` /// #![feature(phase)] @@ -47,7 +47,7 @@ macro_rules! log( /// A convenience macro for logging at the error log level. /// -/// # Example +/// ## Example /// /// ``` /// #![feature(phase)] @@ -65,7 +65,7 @@ macro_rules! error( /// A convenience macro for logging at the warning log level. /// -/// # Example +/// ## Example /// /// ``` /// #![feature(phase)] @@ -83,7 +83,7 @@ macro_rules! warn( /// A convenience macro for logging at the info log level. /// -/// # Example +/// ## Example /// /// ``` /// #![feature(phase)] @@ -103,7 +103,7 @@ macro_rules! info( /// be omitted at compile time by passing `--cfg ndebug` to the compiler. If /// this option is not passed, then debug statements will be compiled. /// -/// # Example +/// ## Example /// /// ``` /// #![feature(phase)] @@ -120,7 +120,7 @@ macro_rules! debug( /// A macro to test whether a log level is enabled for the current module. /// -/// # Example +/// ## Example /// /// ``` /// #![feature(phase)] diff --git a/src/libnative/io/c_win32.rs b/src/libnative/io/c_win32.rs index 482155c339c9b..f6bfbb76e6d50 100644 --- a/src/libnative/io/c_win32.rs +++ b/src/libnative/io/c_win32.rs @@ -105,7 +105,8 @@ pub mod compat { /// Macro for creating a compatibility fallback for a Windows function /// - /// # Example + /// ## Example + /// /// ``` /// compat_fn!(adll32::SomeFunctionW(_arg: LPCWSTR) { /// // Fallback implementation diff --git a/src/libnative/io/pipe_win32.rs b/src/libnative/io/pipe_win32.rs index 79ca23abed25c..e473dacf9a4e1 100644 --- a/src/libnative/io/pipe_win32.rs +++ b/src/libnative/io/pipe_win32.rs @@ -15,7 +15,7 @@ //! didn't exactly turn out very cleanly. If you, too, are new to named pipes, //! read on as I'll try to explain some fun things that I ran into. //! -//! # Unix pipes vs Named pipes +//! ## Unix pipes vs Named pipes //! //! As with everything else, named pipes on windows are pretty different from //! unix pipes on unix. On unix, you use one "server pipe" to accept new client @@ -25,7 +25,7 @@ //! or not. Once attached to a client, a server pipe may then disconnect at a //! later date. //! -//! # Accepting clients +//! ## Accepting clients //! //! As with most other I/O interfaces, our Listener/Acceptor/Stream interfaces //! are built around the unix flavors. This means that we have one "server @@ -42,7 +42,7 @@ //! This model ends up having a small race or two, and you can find more details //! on the `native_accept` method. //! -//! # Simultaneous reads and writes +//! ## Simultaneous reads and writes //! //! In testing, I found that two simultaneous writes and two simultaneous reads //! on a pipe ended up working out just fine, but problems were encountered when @@ -77,7 +77,7 @@ //! ConnectNamedPipe function is nonblocking, implying that the Listener needs //! to have yet another event to do the actual blocking. //! -//! # Conclusion +//! ## Conclusion //! //! The conclusion here is that I probably don't know the best way to work with //! windows named pipes, but the solution here seems to work well enough to get diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index d358aa6b6453e..691ac2566a389 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -14,7 +14,7 @@ //! runtime. In addition, all I/O provided by this crate is the thread blocking //! version of I/O. //! -//! # Starting with libnative +//! ## Starting with libnative //! //! ```rust //! extern crate native; @@ -29,7 +29,7 @@ //! } //! ``` //! -//! # Force spawning a native task +//! ## Force spawning a native task //! //! ```rust //! extern crate native; diff --git a/src/libnum/integer.rs b/src/libnum/integer.rs index bcaebbd136809..dc3bf0f675e4a 100644 --- a/src/libnum/integer.rs +++ b/src/libnum/integer.rs @@ -15,7 +15,7 @@ pub trait Integer: Num + PartialOrd + Rem { /// Floored integer division. /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; @@ -39,7 +39,7 @@ pub trait Integer: Num + PartialOrd /// assert!(n.div_floor(&d) * d + n.mod_floor(&d) == n) /// ~~~ /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; @@ -57,7 +57,7 @@ pub trait Integer: Num + PartialOrd /// Greatest Common Divisor (GCD). /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; @@ -68,7 +68,7 @@ pub trait Integer: Num + PartialOrd /// Lowest Common Multiple (LCM). /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; @@ -79,7 +79,7 @@ pub trait Integer: Num + PartialOrd /// Returns `true` if `other` divides evenly into `self`. /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; @@ -90,7 +90,7 @@ pub trait Integer: Num + PartialOrd /// Returns `true` if the number is even. /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; @@ -101,7 +101,7 @@ pub trait Integer: Num + PartialOrd /// Returns `true` if the number is odd. /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; @@ -113,7 +113,7 @@ pub trait Integer: Num + PartialOrd /// Simultaneous truncated integer division and modulus. /// Returns `(quotient, remainder)`. /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; @@ -135,7 +135,7 @@ pub trait Integer: Num + PartialOrd /// Simultaneous floored integer division and modulus. /// Returns `(quotient, remainder)`. /// - /// # Examples + /// ## Examples /// /// ~~~ /// # use num::Integer; diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs index 7d1a4409718fa..f6f071d61ae06 100644 --- a/src/librand/distributions/exponential.rs +++ b/src/librand/distributions/exponential.rs @@ -56,7 +56,7 @@ impl Rand for Exp1 { /// This distribution has density function: `f(x) = lambda * /// exp(-lambda * x)` for `x > 0`. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 7b6e94eaa9209..d86ff66a10f28 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -34,7 +34,7 @@ use super::{IndependentSample, Sample, Exp}; /// == 1`, and using the boosting technique described in [1] for /// `shape < 1`. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; @@ -181,7 +181,7 @@ impl IndependentSample for GammaLargeShape { /// `k`, this uses the equivalent characterisation `χ²(k) = Gamma(k/2, /// 2)`. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; @@ -238,7 +238,7 @@ impl IndependentSample for ChiSquared { /// chi-squared distributions, that is, `F(m,n) = (χ²(m)/m) / /// (χ²(n)/n)`. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; @@ -282,7 +282,7 @@ impl IndependentSample for FisherF { /// The Student t distribution, `t(nu)`, where `nu` is the degrees of /// freedom. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index faafbc4421e24..707a5a109053b 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -90,7 +90,7 @@ pub struct Weighted { /// all `T`, as is `uint`, so one can store references or indices into /// another vector. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs index 507cafd283590..5449bf09892a8 100644 --- a/src/librand/distributions/normal.rs +++ b/src/librand/distributions/normal.rs @@ -72,7 +72,7 @@ impl Rand for StandardNormal { /// This uses the ZIGNOR variant of the Ziggurat method, see /// `StandardNormal` for more details. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; @@ -115,7 +115,7 @@ impl IndependentSample for Normal { /// If `X` is log-normal distributed, then `ln(X)` is `N(mean, /// std_dev**2)` distributed. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index a6b23957fd648..769cd7ad3bb6e 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -32,7 +32,7 @@ use distributions::{Sample, IndependentSample}; /// primitive integer types satisfy this property, and the float types /// normally satisfy it, but rounding may mean `high` can occur. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand; diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 9c33b713e4a6b..fb8bb1d6569ca 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -95,7 +95,7 @@ pub trait Rng { /// (e.g. reading past the end of a file that is being used as the /// source of randomness). /// - /// # Example + /// ## Example /// /// ```rust /// use std::rand::{task_rng, Rng}; @@ -130,7 +130,7 @@ pub trait Rng { /// Return a random value of a `Rand` type. /// - /// # Example + /// ## Example /// /// ```rust /// use std::rand::{task_rng, Rng}; @@ -148,7 +148,7 @@ pub trait Rng { /// Return an iterator which will yield an infinite number of randomly /// generated items. /// - /// # Example + /// ## Example /// /// ``` /// use std::rand::{task_rng, Rng}; @@ -172,7 +172,7 @@ pub trait Rng { /// that will amortize the computations that allow for perfect /// uniformity, as they only happen on initialization. /// - /// # Example + /// ## Example /// /// ```rust /// use std::rand::{task_rng, Rng}; @@ -190,7 +190,7 @@ pub trait Rng { /// Return a bool with a 1 in n chance of true /// - /// # Example + /// ## Example /// /// ```rust /// use std::rand::{task_rng, Rng}; @@ -204,7 +204,7 @@ pub trait Rng { /// Return an iterator of random characters from the set A-Z,a-z,0-9. /// - /// # Example + /// ## Example /// /// ```rust /// use std::rand::{task_rng, Rng}; @@ -220,7 +220,7 @@ pub trait Rng { /// /// Return `None` if `values` is empty. /// - /// # Example + /// ## Example /// /// ``` /// use std::rand::{task_rng, Rng}; @@ -246,7 +246,7 @@ pub trait Rng { /// Shuffle a mutable slice in place. /// - /// # Example + /// ## Example /// /// ```rust /// use std::rand::{task_rng, Rng}; @@ -304,7 +304,7 @@ impl<'a, R: Rng> Iterator for AsciiGenerator<'a, R> { pub trait SeedableRng: Rng { /// Reseed an RNG with the given seed. /// - /// # Example + /// ## Example /// /// ```rust /// use std::rand::{Rng, SeedableRng, StdRng}; @@ -318,7 +318,7 @@ pub trait SeedableRng: Rng { /// Create a new RNG with the given seed. /// - /// # Example + /// ## Example /// /// ```rust /// use std::rand::{Rng, SeedableRng, StdRng}; @@ -421,7 +421,8 @@ impl Rand for XorShiftRng { /// `Rand` implementation for `f32` and `f64` for the half-open /// `[0,1)`. /// -/// # Example +/// ## Example +/// /// ```rust /// use std::rand::{random, Open01}; /// @@ -437,7 +438,7 @@ pub struct Open01(pub F); /// `Rand` implementation of `f32` and `f64` for the half-open /// `[0,1)`. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand::{random, Closed01}; diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs index 7a237670890ca..d0dd20e4e782c 100644 --- a/src/librand/reseeding.rs +++ b/src/librand/reseeding.rs @@ -33,7 +33,7 @@ pub struct ReseedingRng { impl> ReseedingRng { /// Create a new `ReseedingRng` with the given parameters. /// - /// # Arguments + /// ## Arguments /// /// * `rng`: the random number generator to use. /// * `generation_threshold`: the number of bytes of entropy at which to reseed the RNG. @@ -100,7 +100,7 @@ impl, Rsdr: Reseeder + Default> /// Something that can be used to reseed an RNG via `ReseedingRng`. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand::{Rng, SeedableRng, StdRng}; diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs index fae3e5986806d..76cd2300bfa73 100644 --- a/src/libregex/lib.rs +++ b/src/libregex/lib.rs @@ -21,7 +21,7 @@ //! support and exhaustively lists the supported syntax. For more specific //! details on the API, please see the documentation for the `Regex` type. //! -//! # First example: find a date +//! ## First example: find a date //! //! General use of regular expressions in this package involves compiling an //! expression and then using it to search, split or replace text. For example, @@ -46,7 +46,7 @@ //! not process any escape sequences. For example, `"\\d"` is the same //! expression as `r"\d"`. //! -//! # The `regex!` macro +//! ## The `regex!` macro //! //! Rust's compile time meta-programming facilities provide a way to write a //! `regex!` macro which compiles regular expressions *when your program @@ -88,7 +88,7 @@ //! expressions, but 100+ calls to `regex!` will probably result in a //! noticeably bigger binary. //! -//! # Example: iterating over capture groups +//! ## Example: iterating over capture groups //! //! This crate provides convenient iterators for matching an expression //! repeatedly against a search string to find successive non-overlapping @@ -114,7 +114,7 @@ //! Notice that the year is in the capture group indexed at `1`. This is //! because the *entire match* is stored in the capture group at index `0`. //! -//! # Example: replacement with named capture groups +//! ## Example: replacement with named capture groups //! //! Building on the previous example, perhaps we'd like to rearrange the date //! formats. This can be done with text replacement. But to make the code @@ -136,7 +136,7 @@ //! provides more flexibility than is seen here. (See the documentation for //! `Regex::replace` for more details.) //! -//! # Pay for what you use +//! ## Pay for what you use //! //! With respect to searching text with a regular expression, there are three //! questions that can be asked: @@ -154,7 +154,7 @@ //! only need to test if an expression matches a string. (Use `is_match` //! instead.) //! -//! # Unicode +//! ## Unicode //! //! This implementation executes regular expressions **only** on sequences of //! Unicode code points while exposing match locations as byte indices into the @@ -190,7 +190,7 @@ //! # } //! ``` //! -//! # Syntax +//! ## Syntax //! //! The syntax supported in this crate is almost in an exact correspondence //! with the syntax supported by RE2. @@ -339,7 +339,7 @@ //! [:xdigit:] hex digit ([0-9A-Fa-f]) //! //! -//! # Untrusted input +//! ## Untrusted input //! //! There are two factors to consider here: untrusted regular expressions and //! untrusted search text. diff --git a/src/libregex/re.rs b/src/libregex/re.rs index 8e4145b2a3198..e44e767127713 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -68,7 +68,7 @@ pub fn is_match(regex: &str, text: &str) -> Result { /// methods. All other methods (searching and splitting) return borrowed /// pointers into the string given. /// -/// # Examples +/// ## Examples /// /// Find the location of a US phone number: /// @@ -165,7 +165,7 @@ impl Regex { /// Returns true if and only if the regex matches the string given. /// - /// # Example + /// ## Example /// /// Test if some text contains at least one word with exactly 13 /// characters: @@ -190,7 +190,7 @@ impl Regex { /// of the match. Testing the existence of a match is faster if you use /// `is_match`. /// - /// # Example + /// ## Example /// /// Find the start and end location of the first word with exactly 13 /// characters: @@ -217,7 +217,7 @@ impl Regex { /// `text`, returning the start and end byte indices with respect to /// `text`. /// - /// # Example + /// ## Example /// /// Find the start and end location of every word with exactly 13 /// characters: @@ -254,7 +254,7 @@ impl Regex { /// Otherwise, `find` is faster for discovering the location of the overall /// match. /// - /// # Examples + /// ## Examples /// /// Say you have some text with movie names and their release years, /// like "'Citizen Kane' (1941)". It'd be nice if we could search for text @@ -307,7 +307,7 @@ impl Regex { /// in `text`. This is operationally the same as `find_iter` (except it /// yields information about submatches). /// - /// # Example + /// ## Example /// /// We can use this to find all movie titles and their release years in /// some text, where the movie is formatted like "'Title' (xxxx)": @@ -344,7 +344,7 @@ impl Regex { /// /// This method will *not* copy the text given. /// - /// # Example + /// ## Example /// /// To split a string delimited by arbitrary amounts of spaces or tabs: /// @@ -374,7 +374,7 @@ impl Regex { /// /// This method will *not* copy the text given. /// - /// # Example + /// ## Example /// /// Get the first two words in some text: /// @@ -403,7 +403,7 @@ impl Regex { /// /// If no match is found, then a copy of the string is returned unchanged. /// - /// # Examples + /// ## Examples /// /// Note that this function is polymorphic with respect to the replacement. /// In typical usage, this can just be a normal string: diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index c7dca1b93efbd..2932f5d5146c6 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -1414,7 +1414,7 @@ fn link_args(cmd: &mut Command, add_local_native_libraries(cmd, sess); add_upstream_native_libraries(cmd, sess); - // # Telling the linker what we're doing + // ## Telling the linker what we're doing if dylib { // On mac we need to tell the linker to let this library be rpathed @@ -1478,7 +1478,7 @@ fn link_args(cmd: &mut Command, } } -// # Native library linking +// ## Native library linking // // User-supplied library search paths (-L on the command line). These are // the same paths used to find Rust crates, so some of them may have been @@ -1528,7 +1528,7 @@ fn add_local_native_libraries(cmd: &mut Command, sess: &Session) { } } -// # Rust Crate linking +// ## Rust Crate linking // // Rust crates are not considered at all when creating an rlib output. All // dependencies will be linked when producing the final output (instead of diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index 1811c4f8612f0..36560011b9516 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -15,7 +15,7 @@ //! is the major guts (along with metadata::creader) of the compiler for loading //! crates and resolving dependencies. Let's take a tour! //! -//! # The problem +//! ## The problem //! //! Each invocation of the compiler is immediately concerned with one primary //! problem, to connect a set of crates to resolved crates on the filesystem. @@ -108,7 +108,7 @@ //! //! To resolve this problem, we come to the next section! //! -//! # Expert Mode +//! ## Expert Mode //! //! A number of flags have been added to the compiler to solve the "version //! problem" in the previous section, as well as generally enabling more @@ -206,7 +206,7 @@ //! In the end, this ends up not needing `--extern` to specify upstream //! transitive dependencies. //! -//! # Wrapping up +//! ## Wrapping up //! //! That's the general overview of loading crates in the compiler, but it's by //! no means all of the necessary details. Take a look at the rest of diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 1c31b671a947b..10c92d9521ace 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -14,7 +14,7 @@ * at a given point. Program execution points are identified by their * id. * - * # Basic idea + * ## Basic idea * * The basic model is that each local variable is assigned an index. We * represent sets of local variables using a vector indexed by this @@ -45,7 +45,7 @@ * Any use of the variable where the variable is dead afterwards is a * last use. * - * # Implementation details + * ## Implementation details * * The actual implementation contains two (nested) walks over the AST. * The outer walk has the job of building up the ir_maps instance for the @@ -1222,7 +1222,7 @@ impl<'a> Liveness<'a> { expr: &Expr, succ: LiveNode) -> LiveNode { - // # Lvalues + // ## Lvalues // // In general, the full flow graph structure for an // assignment/move/etc can be handled in one of two ways, @@ -1249,7 +1249,7 @@ impl<'a> Liveness<'a> { // // I will cover the two cases in turn: // - // # Tracked lvalues + // ## Tracked lvalues // // A tracked lvalue is a local variable/argument `x`. In // these cases, the link_node where the write occurs is linked @@ -1257,7 +1257,7 @@ impl<'a> Liveness<'a> { // the contents of this node. There are no subcomponents to // consider. // - // # Non-tracked lvalues + // ## Non-tracked lvalues // // These are lvalues like `x[5]` or `x.f`. In that case, we // basically ignore the value which is written to but generate @@ -1265,7 +1265,7 @@ impl<'a> Liveness<'a> { // components reads are generated by // `propagate_through_lvalue_components()` (this fn). // - // # Illegal lvalues + // ## Illegal lvalues // // It is still possible to observe assignments to non-lvalues; // these errors are detected in the later pass borrowck. We diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index a690d5882141f..9834a9400b535 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -9,7 +9,7 @@ // except according to those terms. /*! - * # Categorization + * ## Categorization * * The job of the categorization module is to analyze an expression to * determine what kind of memory is used in evaluating it (for example, @@ -823,7 +823,7 @@ impl<'t,TYPER:Typer> MemCategorizationContext<'t,TYPER> { //! an auto-adjustment, where N is the number of autoderefs //! in that adjustment. //! - //! # Parameters + //! ## Parameters //! - `elt`: the AST node being indexed //! - `base_cmt`: the cmt of `elt` //! - `derefs`: the deref number to be used for diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 0b181d2cf367a..07e47d5d895d4 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -10,7 +10,7 @@ /*! * - * # Compilation of match statements + * ## Compilation of match statements * * I will endeavor to explain the code as best I can. I have only a loose * understanding of some parts of it. @@ -1501,7 +1501,7 @@ pub fn store_arg<'a>(mut bcx: &'a Block<'a>, * Creates entries in the `llargs` map for each of the bindings * in `pat`. * - * # Arguments + * ## Arguments * * - `pat` is the argument pattern * - `llval` is a pointer to the argument value (in other words, @@ -1614,7 +1614,7 @@ fn bind_irrefutable_pat<'a>( * LLVM is able to optimize the code, but it causes longer compile * times and makes the generated code nigh impossible to read. * - * # Arguments + * ## Arguments * - bcx: starting basic block context * - pat: the irrefutable pattern being matched. * - val: the value being matched -- must be an lvalue (by ref, with cleanup) diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs index 9ec0407b5c3fc..508b4b90c8e2c 100644 --- a/src/librustc/middle/trans/adt.rs +++ b/src/librustc/middle/trans/adt.rs @@ -9,7 +9,7 @@ // except according to those terms. /*! - * # Representation of Algebraic Data Types + * ## Representation of Algebraic Data Types * * This module determines how to represent enums, structs, and tuples * based on their monomorphized types; it is responsible both for diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index e2ad8b4fd4680..ffdc82c230c86 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -421,7 +421,7 @@ pub fn trans_fn_ref_with_vtables( * Translates a reference to a fn/method item, monomorphizing and * inlining as it goes. * - * # Parameters + * ## Parameters * * - `bcx`: the current block where the reference to the fn occurs * - `def_id`: def id of the fn or method item being referenced diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 1dad6e3cb1843..7c14e8284c680 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -9,7 +9,7 @@ // except according to those terms. /*! - * # Translation of Expressions + * ## Translation of Expressions * * Public entry points: * diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index f305ae90d46af..20023303b5d1f 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -250,7 +250,7 @@ pub fn trans_native_call<'a>( * Prepares a call to a native function. This requires adapting * from the Rust argument passing rules to the native rules. * - * # Parameters + * ## Parameters * * - `callee_ty`: Rust type for the function we are calling * - `llfn`: the function pointer we are calling diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 08a26eefa2273..753caefb115ef 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -747,7 +747,7 @@ fn check_method_body(ccx: &CrateCtxt, /*! * Type checks a method body. * - * # Parameters + * ## Parameters * - `item_generics`: generics defined on the impl/trait that contains * the method * - `self_bound`: bound for the `Self` type parameter, if any @@ -844,7 +844,7 @@ fn check_impl_methods_against_trait(ccx: &CrateCtxt, * Checks that a method from an impl/class conforms to the signature of * the same method as declared in the trait. * - * # Parameters + * ## Parameters * * - impl_generics: the generics declared on the impl itself (not the method!) * - impl_m: type of the method we are checking diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index 708eb498f8421..a7230e5422196 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -10,7 +10,7 @@ /*! * - * # Lattice Variables + * ## Lattice Variables * * This file contains generic code for operating on inference variables * that are characterized by an upper- and lower-bound. The logic and diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index 2ae95309d41d9..a90804cb43683 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -14,7 +14,7 @@ // control *just how much* you want to resolve and how you want to do // it. // -// # Controlling the scope of resolution +// ## Controlling the scope of resolution // // The options resolve_* determine what kinds of variables get // resolved. Generally resolution starts with a top-level type @@ -30,7 +30,7 @@ // whether we resolve floating point and integral variables, // respectively. // -// # What do if things are unconstrained +// ## What do if things are unconstrained // // Sometimes we will encounter a variable that has no constraints, and // therefore cannot sensibly be mapped to any particular result. By @@ -39,7 +39,7 @@ // resolution to fail in this case instead, except for the case of // integral variables, which resolve to `int` if forced. // -// # resolve_all and force_all +// ## resolve_all and force_all // // The options are a bit set, so you can use the *_all to resolve or // force all kinds of variables (including those we may add in the diff --git a/src/librustc_back/sha2.rs b/src/librustc_back/sha2.rs index 681de6a6626be..ca9dea37464a0 100644 --- a/src/librustc_back/sha2.rs +++ b/src/librustc_back/sha2.rs @@ -222,14 +222,14 @@ impl StandardPadding for T { pub trait Digest { /// Provide message data. /// - /// # Arguments + /// ## Arguments /// /// * input - A vector of message data fn input(&mut self, input: &[u8]); /// Retrieve the digest result. This method may be called multiple times. /// - /// # Arguments + /// ## Arguments /// /// * out - the vector to hold the result. Must be large enough to contain output_bits(). fn result(&mut self, out: &mut [u8]); @@ -243,7 +243,7 @@ pub trait Digest { /// Convenience function that feeds a string into a digest. /// - /// # Arguments + /// ## Arguments /// /// * `input` The string to feed into the digest fn input_str(&mut self, input: &str) { diff --git a/src/librustc_back/svh.rs b/src/librustc_back/svh.rs index 94dea6cb540e3..be051f83b57e3 100644 --- a/src/librustc_back/svh.rs +++ b/src/librustc_back/svh.rs @@ -10,7 +10,7 @@ //! Calculation and management of a Strict Version Hash for crates //! -//! # Today's ABI problem +//! ## Today's ABI problem //! //! In today's implementation of rustc, it is incredibly difficult to achieve //! forward binary compatibility without resorting to C-like interfaces. Within @@ -28,7 +28,7 @@ //! not currently support forwards ABI compatibility (in place upgrades of a //! crate). //! -//! # SVH and how it alleviates the problem +//! ## SVH and how it alleviates the problem //! //! With all of this knowledge on hand, this module contains the implementation //! of a notion of a "Strict Version Hash" for a crate. This is essentially a @@ -42,7 +42,7 @@ //! By encoding this strict version hash into all crate's metadata, stale crates //! can be detected immediately and error'd about by rustc itself. //! -//! # Relevant links +//! ## Relevant links //! //! Original issue: https://github.com/rust-lang/rust/issues/10207 diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index 45c75ccd1ab42..4141fc420ad31 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -148,7 +148,7 @@ impl TocBuilder { } }; // fill in any missing zeros, e.g. for - // # Foo (1) + // ## Foo (1) // ### Bar (1.0.1) for _ in range(toc_level, level - 1) { sec_number.push_str("0."); diff --git a/src/librustrt/c_str.rs b/src/librustrt/c_str.rs index 5dd61c03d17e7..56ef9cb7f2154 100644 --- a/src/librustrt/c_str.rs +++ b/src/librustrt/c_str.rs @@ -158,7 +158,7 @@ impl CString { /// let p = foo.to_c_str().as_ptr(); /// ``` /// - /// # Example + /// ## Example /// /// ```rust /// extern crate libc; @@ -311,7 +311,7 @@ impl fmt::Show for CString { pub trait ToCStr { /// Copy the receiver into a CString. /// - /// # Failure + /// ## Failure /// /// Fails the task if the receiver has an interior null. fn to_c_str(&self) -> CString; @@ -322,7 +322,7 @@ pub trait ToCStr { /// Work with a temporary CString constructed from the receiver. /// The provided `*libc::c_char` will be freed immediately upon return. /// - /// # Example + /// ## Example /// /// ```rust /// extern crate libc; @@ -334,7 +334,7 @@ pub trait ToCStr { /// } /// ``` /// - /// # Failure + /// ## Failure /// /// Fails the task if the receiver has an interior null. #[inline] diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs index b7366f440d034..3dc7ed8b8f3be 100644 --- a/src/librustrt/local_data.rs +++ b/src/librustrt/local_data.rs @@ -140,12 +140,12 @@ impl KeyValue { /// If this key is already present in TLS, then the previous value is /// replaced with the provided data, and then returned. /// - /// # Failure + /// ## Failure /// /// This function will fail if this key is present in TLS and currently on /// loan with the `get` method. /// - /// # Example + /// ## Example /// /// ``` /// local_data_key!(foo: int) @@ -214,7 +214,7 @@ impl KeyValue { /// loan on this TLS key. While on loan, this key cannot be altered via the /// `replace` method. /// - /// # Example + /// ## Example /// /// ``` /// local_data_key!(key: int) diff --git a/src/librustrt/local_ptr.rs b/src/librustrt/local_ptr.rs index c94e5c6187b3a..1dadc7487782b 100644 --- a/src/librustrt/local_ptr.rs +++ b/src/librustrt/local_ptr.rs @@ -67,7 +67,7 @@ impl DerefMut for Borrowed { /// Borrow the thread-local value from thread-local storage. /// While the value is borrowed it is not available in TLS. /// -/// # Safety note +/// ## Safety note /// /// Does not validate the pointer type. #[inline] @@ -153,7 +153,7 @@ pub mod compiled { /// Give a pointer to thread-local storage. /// - /// # Safety note + /// ## Safety note /// /// Does not validate the pointer type. #[inline(never)] // see comments above @@ -163,7 +163,7 @@ pub mod compiled { /// Take ownership of a pointer from thread-local storage. /// - /// # Safety note + /// ## Safety note /// /// Does not validate the pointer type. #[inline(never)] // see comments above @@ -178,7 +178,7 @@ pub mod compiled { /// Optionally take ownership of a pointer from thread-local storage. /// - /// # Safety note + /// ## Safety note /// /// Does not validate the pointer type. #[inline(never)] // see comments above @@ -196,7 +196,7 @@ pub mod compiled { /// Take ownership of a pointer from thread-local storage. /// - /// # Safety note + /// ## Safety note /// /// Does not validate the pointer type. /// Leaves the old pointer in TLS for speed. @@ -259,7 +259,7 @@ pub mod native { /// Give a pointer to thread-local storage. /// - /// # Safety note + /// ## Safety note /// /// Does not validate the pointer type. #[inline] @@ -271,7 +271,7 @@ pub mod native { /// Take ownership of a pointer from thread-local storage. /// - /// # Safety note + /// ## Safety note /// /// Does not validate the pointer type. #[inline] @@ -288,7 +288,7 @@ pub mod native { /// Optionally take ownership of a pointer from thread-local storage. /// - /// # Safety note + /// ## Safety note /// /// Does not validate the pointer type. #[inline] @@ -310,7 +310,7 @@ pub mod native { /// Take ownership of a pointer from thread-local storage. /// - /// # Safety note + /// ## Safety note /// /// Does not validate the pointer type. /// Leaves the old pointer in TLS for speed. @@ -337,7 +337,7 @@ pub mod native { /// Borrow a mutable reference to the thread-local value /// - /// # Safety Note + /// ## Safety Note /// /// Because this leaves the value in thread-local storage it is possible /// For the Scheduler pointer to be aliased diff --git a/src/librustrt/mutex.rs b/src/librustrt/mutex.rs index c999a08eb93b6..70a05d135a1c2 100644 --- a/src/librustrt/mutex.rs +++ b/src/librustrt/mutex.rs @@ -30,7 +30,7 @@ //! concurrency primitives should be used before them: the `sync` crate defines //! `StaticMutex` and `Mutex` types. //! -//! # Example +//! ## Example //! //! ```rust //! use std::rt::mutex::{NativeMutex, StaticNativeMutex, NATIVE_MUTEX_INIT}; @@ -105,7 +105,7 @@ impl StaticNativeMutex { /// Acquires this lock. This assumes that the current thread does not /// already hold the lock. /// - /// # Example + /// ## Example /// /// ```rust /// use std::rt::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT}; @@ -116,7 +116,7 @@ impl StaticNativeMutex { /// } // automatically unlocked in `_guard`'s destructor /// ``` /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe because it will not function correctly if this /// mutex has been *moved* since it was last used. The mutex can move an @@ -136,7 +136,7 @@ impl StaticNativeMutex { /// Attempts to acquire the lock. The value returned is `Some` if /// the attempt succeeded. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe for the same reasons as `lock`. pub unsafe fn trylock<'a>(&'a self) -> Option> { @@ -152,7 +152,7 @@ impl StaticNativeMutex { /// These needs to be paired with a call to `.unlock_noguard`. Prefer using /// `.lock`. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe for the same reasons as `lock`. Additionally, this /// does not guarantee that the mutex will ever be unlocked, and it is @@ -166,7 +166,7 @@ impl StaticNativeMutex { /// If `true` is returned, this needs to be paired with a call to /// `.unlock_noguard`. Prefer using `.trylock`. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe for the same reasons as `lock_noguard`. pub unsafe fn trylock_noguard(&self) -> bool { @@ -176,7 +176,7 @@ impl StaticNativeMutex { /// Unlocks the lock. This assumes that the current thread already holds the /// lock. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe for the same reasons as `lock`. Additionally, it /// is not guaranteed that this is unlocking a previously locked mutex. It @@ -189,7 +189,7 @@ impl StaticNativeMutex { /// using `LockGuard.wait` since that guarantees that the lock is /// held. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe for the same reasons as `lock`. Additionally, this /// is unsafe because the mutex may not be currently locked. @@ -197,7 +197,7 @@ impl StaticNativeMutex { /// Signals a thread in `wait` to wake up /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe for the same reasons as `lock`. Additionally, this /// is unsafe because the mutex may not be currently locked. @@ -222,7 +222,7 @@ impl NativeMutex { /// Acquires this lock. This assumes that the current thread does not /// already hold the lock. /// - /// # Example + /// ## Example /// /// ```rust /// use std::rt::mutex::NativeMutex; @@ -236,7 +236,7 @@ impl NativeMutex { /// } /// ``` /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe due to the same reasons as /// `StaticNativeMutex::lock`. @@ -247,7 +247,7 @@ impl NativeMutex { /// Attempts to acquire the lock. The value returned is `Some` if /// the attempt succeeded. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe due to the same reasons as /// `StaticNativeMutex::trylock`. @@ -260,7 +260,7 @@ impl NativeMutex { /// These needs to be paired with a call to `.unlock_noguard`. Prefer using /// `.lock`. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe due to the same reasons as /// `StaticNativeMutex::lock_noguard`. @@ -273,7 +273,7 @@ impl NativeMutex { /// If `true` is returned, this needs to be paired with a call to /// `.unlock_noguard`. Prefer using `.trylock`. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe due to the same reasons as /// `StaticNativeMutex::trylock_noguard`. @@ -284,7 +284,7 @@ impl NativeMutex { /// Unlocks the lock. This assumes that the current thread already holds the /// lock. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe due to the same reasons as /// `StaticNativeMutex::unlock_noguard`. @@ -296,7 +296,7 @@ impl NativeMutex { /// using `LockGuard.wait` since that guarantees that the lock is /// held. /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe due to the same reasons as /// `StaticNativeMutex::wait_noguard`. @@ -304,7 +304,7 @@ impl NativeMutex { /// Signals a thread in `wait` to wake up /// - /// # Unsafety + /// ## Unsafety /// /// This method is unsafe due to the same reasons as /// `StaticNativeMutex::signal_noguard`. diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index d27a4f25b4e70..d8f46626316c5 100644 --- a/src/librustrt/task.rs +++ b/src/librustrt/task.rs @@ -66,7 +66,7 @@ use collections::str::SendStr; /// context while having a point in the future where destruction is allowed. /// More information can be found on these specific methods. /// -/// # Example +/// ## Example /// /// ```no_run /// extern crate native; @@ -187,7 +187,7 @@ impl Task { /// It is invalid to call this function with a task that has been previously /// destroyed via a failed call to `run`. /// - /// # Example + /// ## Example /// /// ```no_run /// extern crate native; diff --git a/src/librustuv/lib.rs b/src/librustuv/lib.rs index 24b8c29785804..faad64eea5cfa 100644 --- a/src/librustuv/lib.rs +++ b/src/librustuv/lib.rs @@ -114,7 +114,7 @@ pub mod stream; /// for the `event_loop_factory` field. Using this function as the event loop /// factory will power programs with libuv and enable green threading. /// -/// # Example +/// ## Example /// /// ``` /// extern crate rustuv; diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs index 9a30e87647a83..f0566c31ea7b9 100644 --- a/src/libserialize/base64.rs +++ b/src/libserialize/base64.rs @@ -63,7 +63,7 @@ impl<'a> ToBase64 for &'a [u8] { /** * Turn a vector of `u8` bytes into a base64 string. * - * # Example + * ## Example * * ```rust * extern crate serialize; @@ -186,7 +186,7 @@ impl<'a> FromBase64 for &'a str { * You can use the `String::from_utf8` function in `std::string` to turn a * `Vec` into a string with characters corresponding to those values. * - * # Example + * ## Example * * This converts a string literal to base64 and back. * diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index fa5b3ca4040d0..719e856c8a4cf 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -27,7 +27,7 @@ impl<'a> ToHex for &'a [u8] { /** * Turn a vector of `u8` bytes into a hexadecimal string. * - * # Example + * ## Example * * ```rust * extern crate serialize; @@ -85,7 +85,7 @@ impl<'a> FromHex for &'a str { * You can use the `String::from_utf8` function in `std::string` to turn a * `Vec` into a string with characters corresponding to those values. * - * # Example + * ## Example * * This converts a string literal to hexadecimal and back. * diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs index 834d461f20ba1..f47f1fedb1f8e 100644 --- a/src/libstd/bitflags.rs +++ b/src/libstd/bitflags.rs @@ -14,7 +14,7 @@ //! The flags should only be defined for integer types, otherwise unexpected //! type errors may occur at compile time. //! -//! # Example +//! ## Example //! //! ~~~rust //! bitflags!( @@ -71,18 +71,18 @@ //! } //! ~~~ //! -//! # Attributes +//! ## Attributes //! //! Attributes can be attached to the generated `struct` by placing them //! before the `flags` keyword. //! -//! # Derived traits +//! ## Derived traits //! //! The `PartialEq` and `Clone` traits are automatically derived for the `struct` using //! the `deriving` attribute. Additional traits can be derived by providing an //! explicit `deriving` attribute on `flags`. //! -//! # Operators +//! ## Operators //! //! The following operator traits are implemented for the generated `struct`: //! @@ -91,7 +91,7 @@ //! - `Sub`: set difference //! - `Not`: set complement //! -//! # Methods +//! ## Methods //! //! The following methods are defined for the generated `struct`: //! diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index a7d697c8665ef..ed62008c1d091 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -67,7 +67,7 @@ impl CVec { /// Fails if the given pointer is null. The returned vector will not attempt /// to deallocate the vector when dropped. /// - /// # Arguments + /// ## Arguments /// /// * base - A raw pointer to a buffer /// * len - The number of elements in the buffer @@ -85,7 +85,7 @@ impl CVec { /// /// Fails if the given pointer is null. /// - /// # Arguments + /// ## Arguments /// /// * base - A foreign pointer to a buffer /// * len - The number of elements in the buffer diff --git a/src/libstd/collections/hashmap.rs b/src/libstd/collections/hashmap.rs index a569ee4a32a18..9ea147e16fcf4 100644 --- a/src/libstd/collections/hashmap.rs +++ b/src/libstd/collections/hashmap.rs @@ -691,7 +691,7 @@ impl DefaultResizePolicy { /// 3. Emmanuel Goossaert. ["Robin Hood hashing: backward shift /// deletion"](http://codecapsule.com/2013/11/17/robin-hood-hashing-backward-shift-deletion/) /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1039,7 +1039,7 @@ impl, V, S, H: Hasher> MutableMap for HashMap impl HashMap { /// Create an empty HashMap. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1052,7 +1052,7 @@ impl HashMap { /// Creates an empty hash map with the given initial capacity. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1070,7 +1070,7 @@ impl, V, S, H: Hasher> HashMap { /// /// The creates map has the default initial capacity. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1093,7 +1093,7 @@ impl, V, S, H: Hasher> HashMap { /// cause many collisions and very poor performance. Setting it /// manually using this function can expose a DoS attack vector. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1290,7 +1290,7 @@ impl, V, S, H: Hasher> HashMap { /// Return the value corresponding to the key in the map, or insert /// and return the value if it doesn't exist. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1309,7 +1309,7 @@ impl, V, S, H: Hasher> HashMap { /// Return the value corresponding to the key in the map, or create, /// insert, and return a new value if it doesn't exist. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1330,7 +1330,7 @@ impl, V, S, H: Hasher> HashMap { /// Otherwise, modify the existing value for the key. /// Returns the new or modified value for the key. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1362,7 +1362,7 @@ impl, V, S, H: Hasher> HashMap { /// [`insert_or_update_with`](#method.insert_or_update_with) /// for less general and more friendly variations of this. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1419,11 +1419,11 @@ impl, V, S, H: Hasher> HashMap { /// Retrieves a value for the given key. /// See [`find`](../trait.Map.html#tymethod.find) for a non-failing alternative. /// - /// # Failure + /// ## Failure /// /// Fails if the key is not present. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1442,11 +1442,11 @@ impl, V, S, H: Hasher> HashMap { /// Retrieves a mutable value for the given key. /// See [`find_mut`](../trait.MutableMap.html#tymethod.find_mut) for a non-failing alternative. /// - /// # Failure + /// ## Failure /// /// Fails if the key is not present. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1496,7 +1496,7 @@ impl, V, S, H: Hasher> HashMap { /// Remove an equivalent key from the map, returning the value at the /// key if the key was previously in the map. /// - /// # Example + /// ## Example /// /// This is a slightly silly example where we define the number's parity as /// the equivalence class. It is important that the values hash the same, @@ -1558,7 +1558,7 @@ impl, V, S, H: Hasher> HashMap { /// An iterator visiting all keys in arbitrary order. /// Iterator element type is `&'a K`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1579,7 +1579,7 @@ impl, V, S, H: Hasher> HashMap { /// An iterator visiting all values in arbitrary order. /// Iterator element type is `&'a V`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1600,7 +1600,7 @@ impl, V, S, H: Hasher> HashMap { /// An iterator visiting all key-value pairs in arbitrary order. /// Iterator element type is `(&'a K, &'a V)`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1622,7 +1622,7 @@ impl, V, S, H: Hasher> HashMap { /// with mutable references to the values. /// Iterator element type is `(&'a K, &'a mut V)`. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1649,7 +1649,7 @@ impl, V, S, H: Hasher> HashMap { /// pair out of the map in arbitrary order. The map cannot be used after /// calling this. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1670,7 +1670,7 @@ impl, V, S, H: Hasher> HashMap { impl, V: Clone, S, H: Hasher> HashMap { /// Return a copy of the value corresponding to the key. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1685,11 +1685,11 @@ impl, V: Clone, S, H: Hasher> HashMap { /// Return a copy of the value corresponding to the key. /// - /// # Failure + /// ## Failure /// /// Fails if the key is not present. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashMap; @@ -1785,7 +1785,7 @@ pub type SetMoveItems = /// HashMap where the value is (). As with the `HashMap` type, a `HashSet` /// requires that the elements implement the `Eq` and `Hash` traits. /// -/// # Example +/// ## Example /// /// ``` /// use std::collections::HashSet; @@ -1848,7 +1848,7 @@ pub struct HashSet { impl HashSet { /// Create an empty HashSet. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -1862,7 +1862,7 @@ impl HashSet { /// Create an empty HashSet with space for at least `n` elements in /// the hash table. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -1880,7 +1880,7 @@ impl, S, H: Hasher> HashSet { /// /// The hash set is also created with the default initial capacity. /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::HashSet; @@ -1903,7 +1903,7 @@ impl, S, H: Hasher> HashSet { /// cause many collisions and very poor performance. Setting it /// manually using this function can expose a DoS attack vector. /// - /// # Example + /// ## Example /// /// ```rust /// use std::collections::HashSet; @@ -1920,7 +1920,7 @@ impl, S, H: Hasher> HashSet { /// Reserve space for at least `n` elements in the hash table. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -1934,7 +1934,7 @@ impl, S, H: Hasher> HashSet { /// Returns true if the hash set contains a value equivalent to the /// given query value. /// - /// # Example + /// ## Example /// /// This is a slightly silly example where we define the number's /// parity as the equivilance class. It is important that the @@ -1979,7 +1979,7 @@ impl, S, H: Hasher> HashSet { /// An iterator visiting all elements in arbitrary order. /// Iterator element type is &'a T. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -2000,7 +2000,7 @@ impl, S, H: Hasher> HashSet { /// of the set in arbitrary order. The set cannot be used after calling /// this. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -2022,7 +2022,7 @@ impl, S, H: Hasher> HashSet { /// Visit the values representing the difference. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -2051,7 +2051,7 @@ impl, S, H: Hasher> HashSet { /// Visit the values representing the symmetric difference. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -2076,7 +2076,7 @@ impl, S, H: Hasher> HashSet { /// Visit the values representing the intersection. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; @@ -2101,7 +2101,7 @@ impl, S, H: Hasher> HashSet { /// Visit the values representing the union. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::HashSet; diff --git a/src/libstd/collections/lru_cache.rs b/src/libstd/collections/lru_cache.rs index 45e971a675f56..5735dc0171dc4 100644 --- a/src/libstd/collections/lru_cache.rs +++ b/src/libstd/collections/lru_cache.rs @@ -14,7 +14,7 @@ //! (where "used" means a look-up or putting the pair into the cache) //! pair is automatically removed. //! -//! # Example +//! ## Example //! //! ```rust //! use std::collections::LruCache; @@ -93,7 +93,7 @@ impl LruEntry { impl LruCache { /// Create an LRU Cache that holds at most `capacity` items. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::LruCache; @@ -114,7 +114,7 @@ impl LruCache { /// Put a key-value pair into cache. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::LruCache; @@ -157,7 +157,7 @@ impl LruCache { /// Return a value corresponding to the key in the cache. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::LruCache; @@ -191,7 +191,7 @@ impl LruCache { /// Remove and return a value corresponding to the key from the cache. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::LruCache; @@ -213,7 +213,7 @@ impl LruCache { /// Return the maximum number of key-value pairs the cache can hold. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::LruCache; @@ -227,7 +227,7 @@ impl LruCache { /// Change the number of key-value pairs the cache can hold. Remove /// least-recently-used key-value pairs if necessary. /// - /// # Example + /// ## Example /// /// ``` /// use std::collections::LruCache; diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index 2182c43d4a0c2..dd837be9ac26e 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -446,13 +446,13 @@ pub use core::fmt::{secret_pointer}; /// The format function takes a precompiled format string and a list of /// arguments, to return the resulting formatted string. /// -/// # Arguments +/// ## Arguments /// /// * args - a structure of arguments generated via the `format_args!` macro. /// Because this structure can only be safely generated at /// compile-time, this function is safe. /// -/// # Example +/// ## Example /// /// ```rust /// use std::fmt; diff --git a/src/libstd/from_str.rs b/src/libstd/from_str.rs index 21b1e0560a5db..716a0bab86a2c 100644 --- a/src/libstd/from_str.rs +++ b/src/libstd/from_str.rs @@ -34,7 +34,7 @@ impl FromStr for bool { /// /// Yields an `Option`, because `s` may or may not actually be parseable. /// - /// # Examples + /// ## Examples /// /// ```rust /// assert_eq!(from_str::("true"), Some(true)); diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs index 55d1411d77ed2..3daf2bede6ba8 100644 --- a/src/libstd/hash.rs +++ b/src/libstd/hash.rs @@ -14,7 +14,7 @@ * This module provides a generic way to compute the hash of a value. The * simplest way to make a type hashable is to use `#[deriving(Hash)]`: * - * # Example + * ## Example * * ```rust * use std::hash; diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index e25006a7b3952..07de2c6f0df62 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -30,7 +30,7 @@ use vec::Vec; /// `BufferedReader` performs large, infrequent reads on the underlying /// `Reader` and maintains an in-memory buffer of the results. /// -/// # Example +/// ## Example /// /// ```rust /// use std::io::{BufferedReader, File}; @@ -124,7 +124,7 @@ impl Reader for BufferedReader { /// /// This writer will be flushed when it is dropped. /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -286,7 +286,7 @@ impl Reader for InternalBufferedWriter { /// /// The output half will be flushed when this stream is dropped. /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs index cd5887b7add00..acfb69b94b791 100644 --- a/src/libstd/io/comm_adapters.rs +++ b/src/libstd/io/comm_adapters.rs @@ -22,7 +22,7 @@ use vec::Vec; /// Allows reading from a rx. /// -/// # Example +/// ## Example /// /// ``` /// use std::io::ChanReader; @@ -88,7 +88,7 @@ impl Reader for ChanReader { /// Allows writing to a tx. /// -/// # Example +/// ## Example /// /// ``` /// # #![allow(unused_must_use)] diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index 5215aec5dfbfa..fd701ab0d65cd 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -27,13 +27,13 @@ use ptr::RawPtr; /// An iterator that reads a single byte on each iteration, /// until `.read_byte()` returns `EndOfFile`. /// -/// # Notes about the Iteration Protocol +/// ## Notes about the Iteration Protocol /// /// The `Bytes` may yield `None` and thus terminate /// an iteration, but continue to yield elements if iteration /// is attempted again. /// -/// # Error +/// ## Error /// /// Any error other than `EndOfFile` that is produced by the underlying Reader /// is returned by the iterator and should be handled by the caller. diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index 790fe6cb8b93a..9e040b1b582e0 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -79,7 +79,7 @@ use vec::Vec; /// Can be constructed via `File::open()`, `File::create()`, and /// `File::open_mode()`. /// -/// # Error +/// ## Error /// /// This type will return errors as an `IoResult` if operations are /// attempted against it for which its underlying file descriptor was not @@ -95,7 +95,7 @@ impl File { /// Open a file at `path` in the mode specified by the `mode` and `access` /// arguments /// - /// # Example + /// ## Example /// /// ```rust,should_fail /// use std::io::{File, Open, ReadWrite}; @@ -121,7 +121,7 @@ impl File { /// access-limitations indicated by `FileAccess` (e.g. calling `write` on a /// `File` opened as `Read` will return an error at runtime). /// - /// # Error + /// ## Error /// /// This function will return an error under a number of different /// circumstances, to include but not limited to: @@ -164,7 +164,7 @@ impl File { /// /// For more information, see the `File::open_mode` function. /// - /// # Example + /// ## Example /// /// ```rust /// use std::io::File; @@ -181,7 +181,7 @@ impl File { /// /// For more information, see the `File::open_mode` function. /// - /// # Example + /// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -257,7 +257,7 @@ impl File { /// Unlink a file from the underlying filesystem. /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -271,7 +271,7 @@ impl File { /// guaranteed that a file is immediately deleted (e.g. depending on /// platform, other open file descriptors may prevent immediate removal) /// -/// # Error +/// ## Error /// /// This function will return an error if `path` points to a directory, if the /// user lacks permissions to remove the file, or if some other filesystem-level @@ -318,7 +318,7 @@ pub fn unlink(path: &Path) -> IoResult<()> { /// directory, etc. This function will traverse symlinks to query /// information about the destination file. /// -/// # Example +/// ## Example /// /// ```rust /// use std::io::fs; @@ -330,7 +330,7 @@ pub fn unlink(path: &Path) -> IoResult<()> { /// } /// ``` /// -/// # Error +/// ## Error /// /// This function will return an error if the user lacks the requisite permissions /// to perform a `stat` call on the given `path` or if there is no entry in the @@ -349,7 +349,7 @@ pub fn stat(path: &Path) -> IoResult { /// information about the symlink file instead of the file that it points /// to. /// -/// # Error +/// ## Error /// /// See `stat` pub fn lstat(path: &Path) -> IoResult { @@ -404,7 +404,7 @@ fn from_rtio(s: rtio::FileStat) -> FileStat { /// Rename a file or directory to a new name. /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -413,7 +413,7 @@ fn from_rtio(s: rtio::FileStat) -> FileStat { /// fs::rename(&Path::new("foo"), &Path::new("bar")); /// ``` /// -/// # Error +/// ## Error /// /// This function will return an error if the provided `from` doesn't exist, if /// the process lacks permissions to view the contents, or if some other @@ -433,7 +433,7 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> { /// Note that if `from` and `to` both point to the same file, then the file /// will likely get truncated by this operation. /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -442,7 +442,7 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> { /// fs::copy(&Path::new("foo.txt"), &Path::new("bar.txt")); /// ``` /// -/// # Error +/// ## Error /// /// This function will return an error in the following situations, but is not /// limited to just these cases: @@ -488,7 +488,7 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> { /// Changes the permission mode bits found on a file or a directory. This /// function takes a mask from the `io` module /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -501,7 +501,7 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> { /// fs::chmod(&Path::new("file.exe"), io::UserExec); /// ``` /// -/// # Error +/// ## Error /// /// This function will return an error if the provided `path` doesn't exist, if /// the process lacks permissions to change the attributes of the file, or if @@ -550,7 +550,7 @@ pub fn symlink(src: &Path, dst: &Path) -> IoResult<()> { /// Reads a symlink, returning the file that the symlink points to. /// -/// # Error +/// ## Error /// /// This function will return an error on failure. Failure conditions include /// reading a file that does not exist or reading a file which is not a symlink. @@ -564,7 +564,7 @@ pub fn readlink(path: &Path) -> IoResult { /// Create a new, empty directory at the provided path /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -575,7 +575,7 @@ pub fn readlink(path: &Path) -> IoResult { /// fs::mkdir(&p, io::UserRWX); /// ``` /// -/// # Error +/// ## Error /// /// This function will return an error if the user lacks permissions to make a /// new directory at the provided `path`, or if the directory already exists. @@ -590,7 +590,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> { /// Remove an existing, empty directory /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -600,7 +600,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> { /// fs::rmdir(&p); /// ``` /// -/// # Error +/// ## Error /// /// This function will return an error if the user lacks permissions to remove /// the directory at the provided `path`, or if the directory isn't empty. @@ -614,7 +614,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> { /// Retrieve a vector containing all entries within a provided directory /// -/// # Example +/// ## Example /// /// ```rust /// use std::io; @@ -638,7 +638,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> { /// } /// ``` /// -/// # Error +/// ## Error /// /// This function will return an error if the provided `path` doesn't exist, if /// the process lacks permissions to view the contents or if the `path` points @@ -695,7 +695,7 @@ impl Iterator for Directories { /// Recursively create a directory and all of its parent components if they /// are missing. /// -/// # Error +/// ## Error /// /// See `fs::mkdir`. pub fn mkdir_recursive(path: &Path, mode: FilePermission) -> IoResult<()> { @@ -732,7 +732,7 @@ pub fn mkdir_recursive(path: &Path, mode: FilePermission) -> IoResult<()> { /// Removes a directory at this path, after removing all its contents. Use /// carefully! /// -/// # Error +/// ## Error /// /// See `file::unlink` and `fs::readdir` pub fn rmdir_recursive(path: &Path) -> IoResult<()> { diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs index b93b84b7d63f3..dd6ea9d5d584d 100644 --- a/src/libstd/io/mem.rs +++ b/src/libstd/io/mem.rs @@ -43,7 +43,7 @@ fn combine(seek: SeekStyle, cur: uint, end: uint, offset: i64) -> IoResult /// Writes to an owned, growable byte vector /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -132,7 +132,7 @@ impl Seek for MemWriter { /// Reads from an owned byte vector /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -227,7 +227,7 @@ impl Buffer for MemReader { /// If a write will not fit in the buffer, it returns an error and does not /// write any data. /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -290,7 +290,7 @@ impl<'a> Seek for BufWriter<'a> { /// Reads from a fixed-size byte slice /// -/// # Example +/// ## Example /// /// ```rust /// # #![allow(unused_must_use)] diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 4277b509962cc..53aec7b4457c2 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -292,7 +292,7 @@ pub type IoResult = Result; /// The type passed to I/O condition handlers to indicate error /// -/// # FIXME +/// ## FIXME /// /// Is something like this sufficient? It's kind of archaic #[deriving(PartialEq, Eq, Clone)] @@ -540,14 +540,14 @@ pub trait Reader { /// Returns the number of bytes read. The number of bytes read may /// be less than the number requested, even 0. Returns `Err` on EOF. /// - /// # Error + /// ## Error /// /// If an error occurs during this I/O operation, then it is returned as /// `Err(IoError)`. Note that end-of-file is considered an error, and can be /// inspected for in the error's `kind` field. Also note that reading 0 /// bytes is not considered an error in all circumstances /// - /// # Implementation Note + /// ## Implementation Note /// /// When implementing this method on a new Reader, you are strongly encouraged /// not to return 0 if you can avoid it. @@ -562,7 +562,7 @@ pub trait Reader { /// read. If `read` returns 0 too many times, `NoProgress` will be /// returned. /// - /// # Error + /// ## Error /// /// If an error occurs at any point, that error is returned, and no further /// bytes are read. @@ -606,7 +606,7 @@ pub trait Reader { /// Returns the number of bytes read. The number of bytes read may be /// less than the number requested, even 0. Returns Err on EOF. /// - /// # Error + /// ## Error /// /// If an error occurs during this I/O operation, then it is returned /// as `Err(IoError)`. See `read()` for more details. @@ -630,7 +630,7 @@ pub trait Reader { /// read. If `read` returns 0 too many times, `NoProgress` will be /// returned. /// - /// # Error + /// ## Error /// /// If an error occurs at any point, that error is returned, and no further /// bytes are read. @@ -662,7 +662,7 @@ pub trait Reader { /// Reads exactly `len` bytes and gives you back a new vector of length /// `len` /// - /// # Error + /// ## Error /// /// Fails with the same conditions as `read`. Additionally returns error /// on EOF. Note that if an error is returned, then some number of bytes may @@ -679,7 +679,7 @@ pub trait Reader { /// Reads all remaining bytes from the stream. /// - /// # Error + /// ## Error /// /// Returns any non-EOF error immediately. Previously read bytes are /// discarded when an error is returned. @@ -700,7 +700,7 @@ pub trait Reader { /// Reads all of the remaining bytes of this stream, interpreting them as a /// UTF-8 encoded stream. The corresponding string is returned. /// - /// # Error + /// ## Error /// /// This function returns all of the same errors as `read_to_end` with an /// additional error if the reader's contents are not a valid sequence of @@ -717,7 +717,7 @@ pub trait Reader { /// Create an iterator that reads a single byte on /// each iteration, until EOF. /// - /// # Error + /// ## Error /// /// Any error other than `EndOfFile` that is produced by the underlying Reader /// is returned by the iterator and should be handled by the caller. @@ -957,7 +957,7 @@ impl<'a> Reader for &'a mut Reader { /// Similar to `slice()` except this function only bounds the slice on the /// capacity of `v`, not the length. /// -/// # Failure +/// ## Failure /// /// Fails when `start` or `end` point outside the capacity of `v`, or when /// `start` > `end`. @@ -978,7 +978,7 @@ unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec, start: uint, end: uint) - /// A `RefReader` is a struct implementing `Reader` which contains a reference /// to another reader. This is often useful when composing streams. /// -/// # Example +/// ## Example /// /// ``` /// # fn main() {} @@ -1031,7 +1031,7 @@ fn extend_sign(val: u64, nbytes: uint) -> i64 { pub trait Writer { /// Write the entirety of a given buffer /// - /// # Errors + /// ## Errors /// /// If an error happens during the I/O operation, the error is returned as /// `Err`. Note that it is considered an error if the entire buffer could @@ -1053,7 +1053,7 @@ pub trait Writer { /// macro, but it is rare that this should explicitly be called. The /// `write!` macro should be favored to invoke this method instead. /// - /// # Errors + /// ## Errors /// /// This function will return any I/O error reported while formatting. fn write_fmt(&mut self, fmt: &fmt::Arguments) -> IoResult<()> { @@ -1296,7 +1296,7 @@ impl<'a> Writer for &'a mut Writer { /// A `RefWriter` is a struct implementing `Writer` which contains a reference /// to another writer. This is often useful when composing streams. /// -/// # Example +/// ## Example /// /// ``` /// # fn main() {} @@ -1340,13 +1340,13 @@ impl Stream for T {} /// An iterator that reads a line on each iteration, /// until `.read_line()` encounters `EndOfFile`. /// -/// # Notes about the Iteration Protocol +/// ## Notes about the Iteration Protocol /// /// The `Lines` may yield `None` and thus terminate /// an iteration, but continue to yield elements if iteration /// is attempted again. /// -/// # Error +/// ## Error /// /// Any error other than `EndOfFile` that is produced by the underlying Reader /// is returned by the iterator and should be handled by the caller. @@ -1367,13 +1367,13 @@ impl<'r, T: Buffer> Iterator> for Lines<'r, T> { /// An iterator that reads a utf8-encoded character on each iteration, /// until `.read_char()` encounters `EndOfFile`. /// -/// # Notes about the Iteration Protocol +/// ## Notes about the Iteration Protocol /// /// The `Chars` may yield `None` and thus terminate /// an iteration, but continue to yield elements if iteration /// is attempted again. /// -/// # Error +/// ## Error /// /// Any error other than `EndOfFile` that is produced by the underlying Reader /// is returned by the iterator and should be handled by the caller. @@ -1404,7 +1404,7 @@ pub trait Buffer: Reader { /// consumed from this buffer returned to ensure that the bytes are never /// returned twice. /// - /// # Error + /// ## Error /// /// This function will return an I/O error if the underlying reader was /// read, but returned an error. Note that it is not an error to return a @@ -1419,7 +1419,7 @@ pub trait Buffer: Reader { /// encoded unicode codepoints. If a newline is encountered, then the /// newline is contained in the returned string. /// - /// # Example + /// ## Example /// /// ```rust /// use std::io; @@ -1428,7 +1428,7 @@ pub trait Buffer: Reader { /// let input = reader.read_line().ok().unwrap_or("nothing".to_string()); /// ``` /// - /// # Error + /// ## Error /// /// This function has the same error semantics as `read_until`: /// @@ -1451,7 +1451,7 @@ pub trait Buffer: Reader { /// Create an iterator that reads a line on each iteration until EOF. /// - /// # Error + /// ## Error /// /// Any error other than `EndOfFile` that is produced by the underlying Reader /// is returned by the iterator and should be handled by the caller. @@ -1463,7 +1463,7 @@ pub trait Buffer: Reader { /// specified byte is encountered, reading ceases and the bytes up to and /// including the delimiter are returned. /// - /// # Error + /// ## Error /// /// If any I/O error is encountered other than EOF, the error is immediately /// returned. Note that this may discard bytes which have already been read, @@ -1508,7 +1508,7 @@ pub trait Buffer: Reader { /// Reads the next utf8-encoded character from the underlying stream. /// - /// # Error + /// ## Error /// /// If an I/O error occurs, or EOF, then this function will return `Err`. /// This function will also return error if the stream does not contain a @@ -1538,7 +1538,7 @@ pub trait Buffer: Reader { /// Create an iterator that reads a utf8-encoded character on each iteration /// until EOF. /// - /// # Error + /// ## Error /// /// Any error other than `EndOfFile` that is produced by the underlying Reader /// is returned by the iterator and should be handled by the caller. @@ -1570,7 +1570,7 @@ pub trait Seek { /// A successful seek clears the EOF indicator. Seeking beyond EOF is /// allowed, but seeking before position 0 is not allowed. /// - /// # Errors + /// ## Errors /// /// * Seeking to a negative offset is considered an error /// * Seeking past the end of the stream does not modify the underlying @@ -1586,7 +1586,7 @@ pub trait Seek { pub trait Listener> { /// Spin up the listener and start queuing incoming connections /// - /// # Error + /// ## Error /// /// Returns `Err` if this listener could not be bound to listen for /// connections. In all cases, this listener is consumed. @@ -1597,7 +1597,7 @@ pub trait Listener> { pub trait Acceptor { /// Wait for and accept an incoming connection /// - /// # Error + /// ## Error /// /// Returns `Err` if an I/O error is encountered. fn accept(&mut self) -> IoResult; @@ -1630,7 +1630,7 @@ impl<'a, T, A: Acceptor> Iterator> for IncomingConnections<'a, A> /// Creates a standard error for a commonly used flavor of error. The `detail` /// field of the returned error will always be `None`. /// -/// # Example +/// ## Example /// /// ``` /// use std::io; @@ -1716,7 +1716,7 @@ pub enum FileType { /// A structure used to describe metadata information about a file. This /// structure is created through the `stat` method on a `Path`. /// -/// # Example +/// ## Example /// /// ``` /// # fn main() {} diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index 8d5fd2b99fd7b..311800209d600 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -82,7 +82,7 @@ pub fn get_host_addresses(host: &str) -> IoResult> { /// Full-fleged resolution. This function will perform a synchronous call to /// getaddrinfo, controlled by the parameters /// -/// # Arguments +/// ## Arguments /// /// * hostname - an optional hostname to lookup against /// * servname - an optional service name, listed in the system services diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs index cb754135bc152..6bf9f37e19f14 100644 --- a/src/libstd/io/net/tcp.rs +++ b/src/libstd/io/net/tcp.rs @@ -38,7 +38,7 @@ use rt::rtio; /// A structure which represents a TCP stream between a local socket and a /// remote socket. /// -/// # Example +/// ## Example /// /// ```no_run /// # #![allow(unused_must_use)] @@ -158,7 +158,7 @@ impl TcpStream { /// This method will close the reading portion of this connection, causing /// all pending and future reads to immediately return with an error. /// - /// # Example + /// ## Example /// /// ```no_run /// # #![allow(unused_must_use)] @@ -225,7 +225,7 @@ impl TcpStream { /// This will overwrite any previous read timeout set through either this /// function or `set_timeout`. /// - /// # Errors + /// ## Errors /// /// When this timeout expires, if there is no pending read operation, no /// action is taken. Otherwise, the read operation will be scheduled to @@ -242,7 +242,7 @@ impl TcpStream { /// This will overwrite any previous write timeout set through either this /// function or `set_timeout`. /// - /// # Errors + /// ## Errors /// /// When this timeout expires, if there is no pending write operation, no /// action is taken. Otherwise, the pending write operation will be @@ -293,7 +293,7 @@ impl Writer for TcpStream { /// A structure representing a socket server. This listener is used to create a /// `TcpAcceptor` which can be used to accept sockets on a local port. /// -/// # Example +/// ## Example /// /// ```rust /// # fn main() { } @@ -403,7 +403,7 @@ impl TcpAcceptor { /// regardless of whether the timeout has expired or not (the accept will /// not block in this case). /// - /// # Example + /// ## Example /// /// ```no_run /// # #![allow(experimental)] diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index 5f7563e7467ba..422518d787a5e 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -31,7 +31,7 @@ use rt::rtio; /// IPv6 addresses, and there is no corresponding notion of a server because UDP /// is a datagram protocol. /// -/// # Example +/// ## Example /// /// ```rust,no_run /// # #![allow(unused_must_use)] diff --git a/src/libstd/io/net/unix.rs b/src/libstd/io/net/unix.rs index 5e7c421497772..993aec7f9d1fa 100644 --- a/src/libstd/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -45,7 +45,7 @@ impl UnixStream { /// /// The returned stream will be closed when the object falls out of scope. /// - /// # Example + /// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -154,7 +154,7 @@ impl UnixListener { /// /// This listener will be closed when it falls out of scope. /// - /// # Example + /// ## Example /// /// ``` /// # fn main() {} diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs index c476a99fee9dc..6729ce6747ecc 100644 --- a/src/libstd/io/pipe.rs +++ b/src/libstd/io/pipe.rs @@ -42,7 +42,7 @@ impl PipeStream { /// This operation consumes ownership of the file descriptor and it will be /// closed once the object is deallocated. /// - /// # Example + /// ## Example /// /// ```rust /// # #![allow(unused_must_use)] @@ -72,7 +72,7 @@ impl PipeStream { /// The structure returned contains a reader and writer I/O object. Data /// written to the writer can be read from the reader. /// - /// # Errors + /// ## Errors /// /// This function can fail to succeed if the underlying OS has run out of /// available resources to allocate a new pipe. diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 1eee69834948f..394eb5c864143 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -45,7 +45,7 @@ use collections::HashMap; /// process is created via the `Command` struct, which configures the spawning /// process and can itself be constructed using a builder-style interface. /// -/// # Example +/// ## Example /// /// ```should_fail /// use std::io::Command; @@ -308,7 +308,7 @@ impl Command { /// Executes the command as a child process, waiting for it to finish and /// collecting all of its output. /// - /// # Example + /// ## Example /// /// ``` /// use std::io::Command; @@ -329,7 +329,7 @@ impl Command { /// Executes a command as a child process, waiting for it to finish and /// collecting its exit status. /// - /// # Example + /// ## Example /// /// ``` /// use std::io::Command; @@ -457,7 +457,7 @@ impl Process { /// of signal delivery correctly, unix implementations may invoke /// `waitpid()` with `WNOHANG` in order to reap the child as necessary. /// - /// # Errors + /// ## Errors /// /// If the signal delivery fails, the corresponding error is returned. pub fn signal(&mut self, signal: int) -> IoResult<()> { @@ -482,7 +482,7 @@ impl Process { /// /// The stdin handle to the child process will be closed before waiting. /// - /// # Errors + /// ## Errors /// /// This function can fail if a timeout was previously specified via /// `set_timeout` and the timeout expires before the child exits. @@ -504,7 +504,7 @@ impl Process { /// A value of `None` will clear any previous timeout, and a value of `Some` /// will override any previously set timeout. /// - /// # Example + /// ## Example /// /// ```no_run /// # #![allow(experimental)] @@ -546,7 +546,7 @@ impl Process { /// /// The stdin handle to the child is closed before waiting. /// - /// # Errors + /// ## Errors /// /// This function can fail for any of the same reasons that `wait()` can /// fail. diff --git a/src/libstd/io/signal.rs b/src/libstd/io/signal.rs index c126866e7159a..21c913bd73d92 100644 --- a/src/libstd/io/signal.rs +++ b/src/libstd/io/signal.rs @@ -65,7 +65,7 @@ pub enum Signum { /// Listener automatically unregisters its handles once it is out of scope. /// However, clients can still unregister signums manually. /// -/// # Example +/// ## Example /// /// ```rust,no_run /// # #![allow(unused_must_use)] @@ -118,7 +118,7 @@ impl Listener { /// a signal, and a later call to `recv` will return the signal that was /// received while no task was waiting on it. /// - /// # Error + /// ## Error /// /// If this function fails to register a signal handler, then an error will /// be returned. diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 45c084b345961..b80327604b0f2 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -306,7 +306,7 @@ impl StdWriter { /// /// If successful, returns `Ok((width, height))`. /// - /// # Error + /// ## Error /// /// This function will return an error if the output stream is not actually /// connected to a TTY instance, or if querying the TTY instance fails. @@ -328,7 +328,7 @@ impl StdWriter { /// Controls whether this output stream is a "raw stream" or simply a normal /// stream. /// - /// # Error + /// ## Error /// /// This function will return an error if the output stream is not actually /// connected to a TTY instance, or if querying the TTY instance fails. diff --git a/src/libstd/io/timer.rs b/src/libstd/io/timer.rs index 1c9e428dcad82..456e4435fc91b 100644 --- a/src/libstd/io/timer.rs +++ b/src/libstd/io/timer.rs @@ -29,7 +29,7 @@ use rt::rtio::{IoFactory, LocalIo, RtioTimer, Callback}; /// period of time. Handles to this timer can also be created in the form of /// receivers which will receive notifications over time. /// -/// # Example +/// ## Example /// /// ``` /// # fn main() {} @@ -107,7 +107,7 @@ impl Timer { /// invalidated at the end of that statement, and all `recv` calls will /// fail. /// - /// # Example + /// ## Example /// /// ```rust /// use std::io::Timer; @@ -149,7 +149,7 @@ impl Timer { /// invalidated at the end of that statement, and all `recv` calls will /// fail. /// - /// # Example + /// ## Example /// /// ```rust /// use std::io::Timer; diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index e928323030c4f..467c71cc16e19 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -34,7 +34,7 @@ impl LimitReader { /// Returns the number of bytes that can be read before the `LimitReader` /// will return EOF. /// - /// # Note + /// ## Note /// /// The reader may reach EOF after reading fewer bytes than indicated by /// this method if the underlying reader reaches EOF. diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 125c3fdf5d90c..0301b9c67398a 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! # The Rust Standard Library +//! ## The Rust Standard Library //! //! The Rust Standard Library provides the essential runtime //! functionality for building portable Rust software. diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index f0732c7d508e8..627d551bd85fc 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -27,7 +27,7 @@ /// The multi-argument form of this macro fails with a string and has the /// `format!` syntax for building a string. /// -/// # Example +/// ## Example /// /// ```should_fail /// # #![allow(unreachable_code)] @@ -73,7 +73,7 @@ macro_rules! fail( /// This will invoke the `fail!` macro if the provided expression cannot be /// evaluated to `true` at runtime. /// -/// # Example +/// ## Example /// /// ``` /// // the failure message for these assertions is the stringified value of the @@ -107,7 +107,7 @@ macro_rules! assert( /// /// On failure, this macro will print the values of the expressions. /// -/// # Example +/// ## Example /// /// ``` /// let a = 3i; @@ -140,7 +140,7 @@ macro_rules! assert_eq( /// checks that are too expensive to be present in a release build but may be /// helpful during development. /// -/// # Example +/// ## Example /// /// ``` /// // the failure message for these assertions is the stringified value of the @@ -170,7 +170,7 @@ macro_rules! debug_assert( /// useful for checks that are too expensive to be present in a release build /// but may be helpful during development. /// -/// # Example +/// ## Example /// /// ``` /// let a = 3i; @@ -186,7 +186,7 @@ macro_rules! debug_assert_eq( /// executed. This is occasionally useful to put after loops that never /// terminate normally, but instead directly return from a function. /// -/// # Example +/// ## Example /// /// ~~~rust /// struct Item { weight: uint } @@ -220,7 +220,7 @@ macro_rules! unimplemented( /// Use the syntax described in `std::fmt` to create a value of type `String`. /// See `std::fmt` for more information. /// -/// # Example +/// ## Example /// /// ``` /// format!("test"); @@ -237,7 +237,7 @@ macro_rules! format( /// Use the `format!` syntax to write data into a buffer of type `&mut Writer`. /// See `std::fmt` for more information. /// -/// # Example +/// ## Example /// /// ``` /// # #![allow(unused_must_use)] @@ -276,7 +276,7 @@ macro_rules! print( /// The syntax of this macro is the same as that used for `format!`. For more /// information, see `std::fmt` and `std::io::stdio`. /// -/// # Example +/// ## Example /// /// ``` /// println!("hello there!"); @@ -289,7 +289,7 @@ macro_rules! println( /// Declare a task-local key with a specific type. /// -/// # Example +/// ## Example /// /// ``` /// local_data_key!(my_integer: int) @@ -334,7 +334,7 @@ macro_rules! vec( /// receivers. It places no restrictions on the types of receivers given to /// this macro, this can be viewed as a heterogeneous select. /// -/// # Example +/// ## Example /// /// ``` /// let (tx1, rx1) = channel(); @@ -401,7 +401,7 @@ pub mod builtin { /// /// For more information, see the documentation in `std::fmt`. /// - /// # Example + /// ## Example /// /// ```rust /// use std::fmt; @@ -427,7 +427,7 @@ pub mod builtin { /// will be emitted. To not emit a compile error, use the `option_env!` /// macro instead. /// - /// # Example + /// ## Example /// /// ```rust /// let home: &'static str = env!("HOME"); @@ -446,7 +446,7 @@ pub mod builtin { /// A compile time error is never emitted when using this macro regardless /// of whether the environment variable is present or not. /// - /// # Example + /// ## Example /// /// ```rust /// let key: Option<&'static str> = option_env!("SECRET_KEY"); @@ -465,7 +465,7 @@ pub mod builtin { /// literals, and integers less than 256. The byte slice returned is the /// utf8-encoding of strings and characters. /// - /// # Example + /// ## Example /// /// ``` /// let rust = bytes!("r", 'u', "st", 255); @@ -484,7 +484,7 @@ pub mod builtin { /// statement or expression position, meaning this macro may be difficult to /// use in some situations. /// - /// # Example + /// ## Example /// /// ``` /// #![feature(concat_idents)] @@ -508,7 +508,7 @@ pub mod builtin { /// Integer and floating point literals are stringified in order to be /// concatenated. /// - /// # Example + /// ## Example /// /// ``` /// let s = concat!("test", 10i, 'b', true); @@ -523,7 +523,7 @@ pub mod builtin { /// the invocation of the `line!()` macro itself, but rather the first macro /// invocation leading up to the invocation of the `line!()` macro. /// - /// # Example + /// ## Example /// /// ``` /// let current_line = line!(); @@ -538,7 +538,7 @@ pub mod builtin { /// the invocation of the `col!()` macro itself, but rather the first macro /// invocation leading up to the invocation of the `col!()` macro. /// - /// # Example + /// ## Example /// /// ``` /// let current_col = col!(); @@ -554,7 +554,7 @@ pub mod builtin { /// first macro invocation leading up to the invocation of the `file!()` /// macro. /// - /// # Example + /// ## Example /// /// ``` /// let this_file = file!(); @@ -569,7 +569,7 @@ pub mod builtin { /// stringification of all the tokens passed to the macro. No restrictions /// are placed on the syntax of the macro invocation itself. /// - /// # Example + /// ## Example /// /// ``` /// let one_plus_one = stringify!(1 + 1); @@ -584,7 +584,7 @@ pub mod builtin { /// contents of the filename specified. The file is located relative to the /// current file (similarly to how modules are found), /// - /// # Example + /// ## Example /// /// ```rust,ignore /// let secret_key = include_str!("secret-key.ascii"); @@ -598,7 +598,7 @@ pub mod builtin { /// the contents of the filename specified. The file is located relative to /// the current file (similarly to how modules are found), /// - /// # Example + /// ## Example /// /// ```rust,ignore /// let secret_key = include_bin!("secret-key.bin"); @@ -612,7 +612,7 @@ pub mod builtin { /// leading back up to the crate root. The first component of the path /// returned is the name of the crate currently being compiled. /// - /// # Example + /// ## Example /// /// ```rust /// mod test { @@ -635,7 +635,7 @@ pub mod builtin { /// The syntax given to this macro is the same syntax as the `cfg` /// attribute. /// - /// # Example + /// ## Example /// /// ```rust /// let my_directory = if cfg!(windows) { diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 680620f5a752f..e468299237646 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -191,7 +191,7 @@ impl FloatMath for f32 { /// Inverse hyperbolic sine /// - /// # Returns + /// ## Returns /// /// - on success, the inverse hyperbolic sine of `self` will be returned /// - `self` if `self` is `0.0`, `-0.0`, `INFINITY`, or `NEG_INFINITY` @@ -206,7 +206,7 @@ impl FloatMath for f32 { /// Inverse hyperbolic cosine /// - /// # Returns + /// ## Returns /// /// - on success, the inverse hyperbolic cosine of `self` will be returned /// - `INFINITY` if `self` is `INFINITY` @@ -221,7 +221,7 @@ impl FloatMath for f32 { /// Inverse hyperbolic tangent /// - /// # Returns + /// ## Returns /// /// - on success, the inverse hyperbolic tangent of `self` will be returned /// - `self` if `self` is `0.0` or `-0.0` @@ -241,7 +241,7 @@ impl FloatMath for f32 { /// Converts a float to a string /// -/// # Arguments +/// ## Arguments /// /// * num - The float value #[inline] @@ -253,7 +253,7 @@ pub fn to_string(num: f32) -> String { /// Converts a float to a string in hexadecimal format /// -/// # Arguments +/// ## Arguments /// /// * num - The float value #[inline] @@ -266,7 +266,7 @@ pub fn to_str_hex(num: f32) -> String { /// Converts a float to a string in a given radix, and a flag indicating /// whether it's a special value /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * radix - The base to use @@ -279,7 +279,7 @@ pub fn to_str_radix_special(num: f32, rdx: uint) -> (String, bool) { /// Converts a float to a string with exactly the number of /// provided significant digits /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * digits - The number of significant digits @@ -293,7 +293,7 @@ pub fn to_str_exact(num: f32, dig: uint) -> String { /// Converts a float to a string with a maximum number of /// significant digits /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * digits - The number of significant digits @@ -307,7 +307,7 @@ pub fn to_str_digits(num: f32, dig: uint) -> String { /// Converts a float to a string using the exponential notation with exactly the number of /// provided digits after the decimal point in the significand /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * digits - The number of digits after the decimal point @@ -322,7 +322,7 @@ pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String { /// Converts a float to a string using the exponential notation with the maximum number of /// digits after the decimal point in the significand /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * digits - The number of digits after the decimal point @@ -337,12 +337,12 @@ pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> String { impl num::ToStrRadix for f32 { /// Converts a float to a string in a given radix /// - /// # Arguments + /// ## Arguments /// /// * num - The float value /// * radix - The base to use /// - /// # Failure + /// ## Failure /// /// Fails if called on a special value like `inf`, `-inf` or `NaN` due to /// possible misinterpretation of the result at higher bases. If those values @@ -374,11 +374,11 @@ impl num::ToStrRadix for f32 { /// /// Leading and trailing whitespace represent an error. /// -/// # Arguments +/// ## Arguments /// /// * num - A string /// -/// # Return value +/// ## Return value /// /// `None` if the string did not represent a valid number. Otherwise, /// `Some(n)` where `n` is the floating-point number represented by `[num]`. @@ -406,11 +406,11 @@ impl FromStr for f32 { /// /// Leading and trailing whitespace represent an error. /// - /// # Arguments + /// ## Arguments /// /// * num - A string /// - /// # Return value + /// ## Return value /// /// `None` if the string did not represent a valid number. Otherwise, /// `Some(n)` where `n` is the floating-point number represented by `num`. @@ -430,12 +430,12 @@ impl num::FromStrRadix for f32 { /// /// Leading and trailing whitespace represent an error. /// - /// # Arguments + /// ## Arguments /// /// * num - A string /// * radix - The base to use. Must lie in the range [2 .. 36] /// - /// # Return value + /// ## Return value /// /// `None` if the string did not represent a valid number. Otherwise, /// `Some(n)` where `n` is the floating-point number represented by `num`. diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 3180ee28c6fee..d9a19a87046dd 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -199,7 +199,7 @@ impl FloatMath for f64 { /// Inverse hyperbolic sine /// - /// # Returns + /// ## Returns /// /// - on success, the inverse hyperbolic sine of `self` will be returned /// - `self` if `self` is `0.0`, `-0.0`, `INFINITY`, or `NEG_INFINITY` @@ -214,7 +214,7 @@ impl FloatMath for f64 { /// Inverse hyperbolic cosine /// - /// # Returns + /// ## Returns /// /// - on success, the inverse hyperbolic cosine of `self` will be returned /// - `INFINITY` if `self` is `INFINITY` @@ -229,7 +229,7 @@ impl FloatMath for f64 { /// Inverse hyperbolic tangent /// - /// # Returns + /// ## Returns /// /// - on success, the inverse hyperbolic tangent of `self` will be returned /// - `self` if `self` is `0.0` or `-0.0` @@ -249,7 +249,7 @@ impl FloatMath for f64 { /// Converts a float to a string /// -/// # Arguments +/// ## Arguments /// /// * num - The float value #[inline] @@ -261,7 +261,7 @@ pub fn to_string(num: f64) -> String { /// Converts a float to a string in hexadecimal format /// -/// # Arguments +/// ## Arguments /// /// * num - The float value #[inline] @@ -274,7 +274,7 @@ pub fn to_str_hex(num: f64) -> String { /// Converts a float to a string in a given radix, and a flag indicating /// whether it's a special value /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * radix - The base to use @@ -287,7 +287,7 @@ pub fn to_str_radix_special(num: f64, rdx: uint) -> (String, bool) { /// Converts a float to a string with exactly the number of /// provided significant digits /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * digits - The number of significant digits @@ -301,7 +301,7 @@ pub fn to_str_exact(num: f64, dig: uint) -> String { /// Converts a float to a string with a maximum number of /// significant digits /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * digits - The number of significant digits @@ -315,7 +315,7 @@ pub fn to_str_digits(num: f64, dig: uint) -> String { /// Converts a float to a string using the exponential notation with exactly the number of /// provided digits after the decimal point in the significand /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * digits - The number of digits after the decimal point @@ -330,7 +330,7 @@ pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String { /// Converts a float to a string using the exponential notation with the maximum number of /// digits after the decimal point in the significand /// -/// # Arguments +/// ## Arguments /// /// * num - The float value /// * digits - The number of digits after the decimal point @@ -345,12 +345,12 @@ pub fn to_str_exp_digits(num: f64, dig: uint, upper: bool) -> String { impl num::ToStrRadix for f64 { /// Converts a float to a string in a given radix /// - /// # Arguments + /// ## Arguments /// /// * num - The float value /// * radix - The base to use /// - /// # Failure + /// ## Failure /// /// Fails if called on a special value like `inf`, `-inf` or `NAN` due to /// possible misinterpretation of the result at higher bases. If those values @@ -382,11 +382,11 @@ impl num::ToStrRadix for f64 { /// /// Leading and trailing whitespace represent an error. /// -/// # Arguments +/// ## Arguments /// /// * num - A string /// -/// # Return value +/// ## Return value /// /// `None` if the string did not represent a valid number. Otherwise, /// `Some(n)` where `n` is the floating-point number represented by `[num]`. @@ -414,11 +414,11 @@ impl FromStr for f64 { /// /// Leading and trailing whitespace represent an error. /// - /// # Arguments + /// ## Arguments /// /// * num - A string /// - /// # Return value + /// ## Return value /// /// `none` if the string did not represent a valid number. Otherwise, /// `Some(n)` where `n` is the floating-point number represented by `num`. @@ -438,12 +438,12 @@ impl num::FromStrRadix for f64 { /// /// Leading and trailing whitespace represent an error. /// - /// # Arguments + /// ## Arguments /// /// * num - A string /// * radix - The base to use. Must lie in the range [2 .. 36] /// - /// # Return value + /// ## Return value /// /// `None` if the string did not represent a valid number. Otherwise, /// `Some(n)` where `n` is the floating-point number represented by `num`. diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index 3c01edf233925..bbc11b75d5fd1 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -20,7 +20,7 @@ macro_rules! int_module (($T:ty) => ( /// /// Yields an `Option` because `buf` may or may not actually be parseable. /// -/// # Examples +/// ## Examples /// /// ``` /// let num = std::i64::parse_bytes([49,50,51,52,53,54,55,56,57], 10); @@ -57,7 +57,7 @@ impl FromStrRadix for $T { /// /// Use in place of x.to_string() when you do not need to store the string permanently /// -/// # Examples +/// ## Examples /// /// ``` /// #![allow(deprecated)] diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index c8528e752e89a..0f93d457788cf 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -150,7 +150,7 @@ static NAN_BUF: [u8, ..3] = ['N' as u8, 'a' as u8, 'N' as u8]; * This is meant to be a common base implementation for all integral string * conversion functions like `to_string()` or `to_str_radix()`. * - * # Arguments + * ## Arguments * - `num` - The number to convert. Accepts any number that * implements the numeric traits. * - `radix` - Base to use. Accepts only the values 2-36. @@ -161,13 +161,13 @@ static NAN_BUF: [u8, ..3] = ['N' as u8, 'a' as u8, 'N' as u8]; * - `f` - a callback which will be invoked for each ascii character * which composes the string representation of this integer * - * # Return value + * ## Return value * A tuple containing the byte vector, and a boolean flag indicating * whether it represents a special value like `inf`, `-inf`, `NaN` or not. * It returns a tuple because there can be ambiguity between a special value * and a number representation at higher bases. * - * # Failure + * ## Failure * - Fails if `radix` < 2 or `radix` > 36. */ #[deprecated = "format!() and friends should be favored instead"] @@ -230,7 +230,7 @@ pub fn int_to_str_bytes_common(num: T, radix: uint, sign: SignFormat, f: * This is meant to be a common base implementation for all numeric string * conversion functions like `to_string()` or `to_str_radix()`. * - * # Arguments + * ## Arguments * - `num` - The number to convert. Accepts any number that * implements the numeric traits. * - `radix` - Base to use. Accepts only the values 2-36. If the exponential notation @@ -246,13 +246,13 @@ pub fn int_to_str_bytes_common(num: T, radix: uint, sign: SignFormat, f: * - `exp_capital` - Whether or not to use a capital letter for the exponent sign, if * exponential notation is desired. * - * # Return value + * ## Return value * A tuple containing the byte vector, and a boolean flag indicating * whether it represents a special value like `inf`, `-inf`, `NaN` or not. * It returns a tuple because there can be ambiguity between a special value * and a number representation at higher bases. * - * # Failure + * ## Failure * - Fails if `radix` < 2 or `radix` > 36. * - Fails if `radix` > 14 and `exp_format` is `ExpDec` due to conflict * between digit and exponent sign `'e'`. @@ -514,7 +514,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; * be a common base implementation for all numeric string conversion * functions like `from_str()` or `from_str_radix()`. * - * # Arguments + * ## Arguments * - `buf` - The byte slice to parse. * - `radix` - Which base to parse the number as. Accepts 2-36. * - `negative` - Whether to accept negative numbers. @@ -534,12 +534,12 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; * - `ignore_underscores` - Whether all underscores within the string should * be ignored. * - * # Return value + * ## Return value * Returns `Some(n)` if `buf` parses to a number n without overflowing, and * `None` otherwise, depending on the constraints set by the remaining * arguments. * - * # Failure + * ## Failure * - Fails if `radix` < 2 or `radix` > 36. * - Fails if `radix` > 14 and `exponent` is `ExpDec` due to conflict * between digit and exponent sign `'e'`. diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index cfcaf0fa8daa3..4c5a0f6a4dc4b 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -21,7 +21,7 @@ macro_rules! uint_module (($T:ty) => ( /// /// Yields an `Option` because `buf` may or may not actually be parseable. /// -/// # Examples +/// ## Examples /// /// ``` /// let num = std::uint::parse_bytes([49,50,51,52,53,54,55,56,57], 10); @@ -58,7 +58,7 @@ impl FromStrRadix for $T { /// /// Use in place of x.to_string() when you do not need to store the string permanently /// -/// # Examples +/// ## Examples /// /// ``` /// #![allow(deprecated)] diff --git a/src/libstd/os.rs b/src/libstd/os.rs index ebcb60253f59c..3b0acfa8e043c 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -72,7 +72,7 @@ static BUF_BYTES : uint = 2048u; /// Returns the current working directory as a Path. /// -/// # Failure +/// ## Failure /// /// Fails if the current working directory value is invalid: /// Possibles cases: @@ -80,7 +80,7 @@ static BUF_BYTES : uint = 2048u; /// * Current directory does not exist. /// * There are insufficient permissions to access the current directory. /// -/// # Example +/// ## Example /// /// ```rust /// use std::os; @@ -105,7 +105,7 @@ pub fn getcwd() -> Path { /// Returns the current working directory as a Path. /// -/// # Failure +/// ## Failure /// /// Fails if the current working directory value is invalid. /// Possibles cases: @@ -113,7 +113,7 @@ pub fn getcwd() -> Path { /// * Current directory does not exist. /// * There are insufficient permissions to access the current directory. /// -/// # Example +/// ## Example /// /// ```rust /// use std::os; @@ -207,7 +207,7 @@ fn with_env_lock(f: || -> T) -> T { /// Invalid UTF-8 bytes are replaced with \uFFFD. See `String::from_utf8_lossy()` /// for details. /// -/// # Example +/// ## Example /// /// ```rust /// use std::os; @@ -314,11 +314,11 @@ pub fn env_as_bytes() -> Vec<(Vec,Vec)> { /// Any invalid UTF-8 bytes in the value are replaced by \uFFFD. See /// `String::from_utf8_lossy()` for details. /// -/// # Failure +/// ## Failure /// /// Fails if `n` has any interior NULs. /// -/// # Example +/// ## Example /// /// ```rust /// use std::os; @@ -337,7 +337,7 @@ pub fn getenv(n: &str) -> Option { /// Fetches the environment variable `n` byte vector from the current process, /// returning None if the variable isn't set. /// -/// # Failure +/// ## Failure /// /// Fails if `n` has any interior NULs. pub fn getenv_as_bytes(n: &str) -> Option> { @@ -382,7 +382,7 @@ pub fn getenv_as_bytes(n: &str) -> Option> { /// Sets the environment variable `n` to the value `v` for the currently running /// process. /// -/// # Example +/// ## Example /// /// ```rust /// use std::os; @@ -454,7 +454,7 @@ pub fn unsetenv(n: &str) { /// Parses input according to platform conventions for the `PATH` /// environment variable. /// -/// # Example +/// ## Example /// ```rust /// use std::os; /// @@ -527,7 +527,7 @@ pub fn split_paths(unparsed: T) -> Vec { /// `Path`s contains an invalid character for constructing the `PATH` /// variable (a double quote on Windows or a colon on Unix). /// -/// # Example +/// ## Example /// /// ```rust /// use std::os; @@ -638,7 +638,7 @@ pub fn dll_filename(base: &str) -> String { /// Optionally returns the filesystem path to the current executable which is /// running but with the executable name. /// -/// # Examples +/// ## Examples /// /// ```rust /// use std::os; @@ -721,7 +721,7 @@ pub fn self_exe_name() -> Option { /// /// Like self_exe_name() but without the binary's name. /// -/// # Example +/// ## Example /// /// ```rust /// use std::os; @@ -737,19 +737,19 @@ pub fn self_exe_path() -> Option { /// Optionally returns the path to the current user's home directory if known. /// -/// # Unix +/// ## Unix /// /// Returns the value of the 'HOME' environment variable if it is set /// and not equal to the empty string. /// -/// # Windows +/// ## Windows /// /// Returns the value of the 'HOME' environment variable if it is /// set and not equal to the empty string. Otherwise, returns the value of the /// 'USERPROFILE' environment variable if it is set and not equal to the empty /// string. /// -/// # Example +/// ## Example /// /// ```rust /// use std::os; @@ -838,7 +838,7 @@ pub fn tmpdir() -> Path { /// directory. If the given path is already an absolute path, return it /// as is. /// -/// # Example +/// ## Example /// ```rust /// use std::os; /// use std::path::Path; @@ -865,7 +865,7 @@ pub fn make_absolute(p: &Path) -> Path { /// Changes the current working directory to the specified path, returning /// whether the change was completed successfully or not. /// -/// # Example +/// ## Example /// ```rust /// use std::os; /// use std::path::Path; @@ -945,7 +945,9 @@ pub fn errno() -> uint { } /// Return the string corresponding to an `errno()` value of `errnum`. -/// # Example +/// +/// ## Example +/// /// ```rust /// use std::os; /// @@ -1239,7 +1241,8 @@ extern "system" { /// /// The arguments are interpreted as utf-8, with invalid bytes replaced with \uFFFD. /// See `String::from_utf8_lossy` for details. -/// # Example +/// +/// ## Example /// /// ```rust /// use std::os; diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 0c93f8e6de979..9a60903516e89 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -142,7 +142,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// Creates a new Path from a byte vector or string. /// The resulting Path will always be normalized. /// - /// # Failure + /// ## Failure /// /// Fails the task if the path contains a NUL. /// @@ -260,7 +260,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// Replaces the filename portion of the path with the given byte vector or string. /// If the replacement name is [], this is equivalent to popping the path. /// - /// # Failure + /// ## Failure /// /// Fails the task if the filename contains a NUL. #[inline] @@ -273,7 +273,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// If the argument is [] or "", this removes the extension. /// If `self` has no filename, this is a no-op. /// - /// # Failure + /// ## Failure /// /// Fails the task if the extension contains a NUL. fn set_extension(&mut self, extension: T) { @@ -311,7 +311,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// byte vector or string. /// See `set_filename` for details. /// - /// # Failure + /// ## Failure /// /// Fails the task if the filename contains a NUL. #[inline] @@ -324,7 +324,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// byte vector or string. /// See `set_extension` for details. /// - /// # Failure + /// ## Failure /// /// Fails the task if the extension contains a NUL. #[inline] @@ -349,7 +349,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// Pushes a path (as a byte vector or string) onto `self`. /// If the argument represents an absolute path, it replaces `self`. /// - /// # Failure + /// ## Failure /// /// Fails the task if the path contains a NUL. #[inline] @@ -381,7 +381,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// (as a byte vector or string). /// If the given path is absolute, the new Path will represent just that. /// - /// # Failure + /// ## Failure /// /// Fails the task if the path contains a NUL. #[inline] diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 877ca2c7e013f..aab16c1e27824 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -351,7 +351,7 @@ impl GenericPath for Path { impl Path { /// Returns a new Path from a byte vector or string /// - /// # Failure + /// ## Failure /// /// Fails the task if the vector contains a NUL. #[inline] diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index d9b802b38fdeb..a0249efd68d4e 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -189,7 +189,7 @@ impl<'a> BytesContainer for &'a Path { impl GenericPathUnsafe for Path { /// See `GenericPathUnsafe::from_vec_unchecked`. /// - /// # Failure + /// ## Failure /// /// Fails if not valid UTF-8. #[inline] @@ -203,7 +203,7 @@ impl GenericPathUnsafe for Path { /// See `GenericPathUnsafe::set_filename_unchecked`. /// - /// # Failure + /// ## Failure /// /// Fails if not valid UTF-8. unsafe fn set_filename_unchecked(&mut self, filename: T) { @@ -630,7 +630,7 @@ impl GenericPath for Path { impl Path { /// Returns a new Path from a byte vector or string /// - /// # Failure + /// ## Failure /// /// Fails the task if the vector contains a NUL. /// Fails if invalid UTF-8. diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index a9b9a907a2642..f46d1ff5947db 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -231,7 +231,7 @@ impl Rng for TaskRng { /// `random()` can generate various types of random things, and so may require /// type hinting to generate the specific type you want. /// -/// # Examples +/// ## Examples /// /// ```rust /// use std::rand; @@ -253,7 +253,7 @@ pub fn random() -> T { /// Randomly sample up to `amount` elements from an iterator. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand::{task_rng, sample}; diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs index fe5d8fc068c91..a17c1770ef66c 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -20,7 +20,7 @@ use result::{Ok, Err}; /// /// It will fail if it there is insufficient data to fulfill a request. /// -/// # Example +/// ## Example /// /// ```rust /// use std::rand::{reader, Rng}; diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index 78da605143dc5..345e0b4f51f5c 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -12,7 +12,7 @@ * A type representing values that may be computed concurrently and * operations for working with them. * - * # Example + * ## Example * * ```rust * use std::sync::Future; diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index da0c3daefe705..f16b1dcdc01ed 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -42,7 +42,7 @@ impl TaskPool { /// `init_fn_factory` returns a function which, given the index of the /// task, should return local data to be kept around in that task. /// - /// # Failure + /// ## Failure /// /// This function will fail if `n_tasks` is less than 1. pub fn new(n_tasks: uint, diff --git a/src/libstd/task.rs b/src/libstd/task.rs index 19ad81a04834d..cd414b2019492 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -36,7 +36,7 @@ //! the main task fails the application will exit with a non-zero //! exit code. //! -//! # Basic task scheduling +//! ## Basic task scheduling //! //! By default, every task is created with the same "flavor" as the calling task. //! This flavor refers to the scheduling mode, with two possibilities currently @@ -51,7 +51,7 @@ //! }) //! ``` //! -//! # Advanced task scheduling +//! ## Advanced task scheduling //! //! Task spawning can also be configured to use a particular scheduler, to //! redirect the new task's output, or to yield a `future` representing the @@ -287,7 +287,7 @@ impl TaskBuilder { /// Taking the value of the future will block until the child task /// terminates. /// - /// # Return value + /// ## Return value /// /// If the child task executes successfully (without failing) then the /// future returns `result::Ok` containing the value returned by the diff --git a/src/libsync/atomics.rs b/src/libsync/atomics.rs index 0be124ad58408..5bc6b4bc241b0 100644 --- a/src/libsync/atomics.rs +++ b/src/libsync/atomics.rs @@ -35,7 +35,7 @@ //! are often used for lazy global initialization. //! //! -//! # Examples +//! ## Examples //! //! A simple spinlock: //! diff --git a/src/libsync/comm/mod.rs b/src/libsync/comm/mod.rs index eff4cea1c43f0..144d5b8cc6580 100644 --- a/src/libsync/comm/mod.rs +++ b/src/libsync/comm/mod.rs @@ -69,7 +69,7 @@ //! program is running on libnative and another is running on libgreen, they can //! still communicate with one another using channels. //! -//! # Example +//! ## Example //! //! Simple usage: //! @@ -312,7 +312,7 @@ // believe that there is anything fundamental which needs to change about these // channels, however, in order to support a more efficient select(). // -// # Conclusion +// ## Conclusion // // And now that you've seen all the races that I found and attempted to fix, // here's the code for you to find some more! @@ -468,7 +468,7 @@ impl UnsafeFlavor for Receiver { /// All data sent on the sender will become available on the receiver, and no /// send will block the calling task (this channel has an "infinite buffer"). /// -/// # Example +/// ## Example /// /// ``` /// let (tx, rx) = channel(); @@ -505,7 +505,7 @@ pub fn channel() -> (Sender, Receiver) { /// As with asynchronous channels, all senders will fail in `send` if the /// `Receiver` has been destroyed. /// -/// # Example +/// ## Example /// /// ``` /// let (tx, rx) = sync_channel(1); @@ -546,7 +546,7 @@ impl Sender { /// /// Rust channels are infinitely buffered so this method will never block. /// - /// # Failure + /// ## Failure /// /// This function will fail if the other end of the channel has hung up. /// This means that if the corresponding receiver has fallen out of scope, @@ -581,12 +581,12 @@ impl Sender { /// /// Like `send`, this method will never block. /// - /// # Failure + /// ## Failure /// /// This method will never fail, it will return the message back to the /// caller if the other end is disconnected /// - /// # Example + /// ## Example /// /// ``` /// let (tx, rx) = channel(); @@ -727,7 +727,7 @@ impl SyncSender { /// time. If the buffer size is 0, however, it can be guaranteed that the /// receiver has indeed received the data if this function returns success. /// - /// # Failure + /// ## Failure /// /// Similarly to `Sender::send`, this function will fail if the /// corresponding `Receiver` for this channel has disconnected. This @@ -752,7 +752,7 @@ impl SyncSender { /// is returned back to the callee. This function is similar to `try_send`, /// except that it will block if the channel is currently full. /// - /// # Failure + /// ## Failure /// /// This function cannot fail. #[unstable = "this function may be renamed to send() in the future"] @@ -770,7 +770,7 @@ impl SyncSender { /// See `SyncSender::send` for notes about guarantees of whether the /// receiver has received the data or not if this function is successful. /// - /// # Failure + /// ## Failure /// /// This function cannot fail #[unstable = "the return type of this function is candidate for \ @@ -810,7 +810,7 @@ impl Receiver { /// on the channel from its paired `Sender` structure. This receiver will /// be woken up when data is ready, and the data will be returned. /// - /// # Failure + /// ## Failure /// /// Similar to channels, this method will trigger a task failure if the /// other end of the channel has hung up (been deallocated). The purpose of diff --git a/src/libsync/comm/oneshot.rs b/src/libsync/comm/oneshot.rs index c9782db5c24b6..b3e38d692caaa 100644 --- a/src/libsync/comm/oneshot.rs +++ b/src/libsync/comm/oneshot.rs @@ -20,7 +20,7 @@ /// for the atomic reference counting), but I was having trouble how to destroy /// the data early in a drop of a Port. /// -/// # Implementation +/// ## Implementation /// /// Oneshots are implemented around one atomic uint variable. This variable /// indicates both the state of the port/chan but also contains any tasks diff --git a/src/libsync/comm/select.rs b/src/libsync/comm/select.rs index 737a4bfe29916..f687fdfaebf57 100644 --- a/src/libsync/comm/select.rs +++ b/src/libsync/comm/select.rs @@ -24,7 +24,7 @@ //! received values of receivers in a much more natural syntax then usage of the //! `Select` structure directly. //! -//! # Example +//! ## Example //! //! ```rust //! let (tx1, rx1) = channel(); diff --git a/src/libsync/deque.rs b/src/libsync/deque.rs index c541cc02774e0..6b59987fe8f46 100644 --- a/src/libsync/deque.rs +++ b/src/libsync/deque.rs @@ -22,7 +22,7 @@ //! The only lock-synchronized portions of this deque are the buffer allocation //! and deallocation portions. Otherwise all operations are lock-free. //! -//! # Example +//! ## Example //! //! use std::sync::deque::BufferPool; //! diff --git a/src/libsync/lock.rs b/src/libsync/lock.rs index e8418f9668f2a..ef832e195ba7e 100644 --- a/src/libsync/lock.rs +++ b/src/libsync/lock.rs @@ -99,7 +99,7 @@ impl<'a> Condvar<'a> { /// /// wait() is equivalent to wait_on(0). /// - /// # Failure + /// ## Failure /// /// A task which is killed while waiting on a condition variable will wake /// up, fail, and unlock the associated lock as it unwinds. @@ -153,7 +153,7 @@ impl<'a> Condvar<'a> { /// type `T`. A mutex always provides exclusive access, and concurrent requests /// will block while the mutex is already locked. /// -/// # Example +/// ## Example /// /// ``` /// use sync::{Mutex, Arc}; @@ -213,7 +213,7 @@ impl Mutex { /// when dropped. All concurrent tasks attempting to lock the mutex will /// block while the returned value is still alive. /// - /// # Failure + /// ## Failure /// /// Failing while inside the Mutex will unlock the Mutex while unwinding, so /// that other tasks won't block forever. It will also poison the Mutex: @@ -254,7 +254,7 @@ impl<'a, T: Send> DerefMut for MutexGuard<'a, T> { /// A dual-mode reader-writer lock. The data can be accessed mutably or /// immutably, and immutably-accessing tasks may run concurrently. /// -/// # Example +/// ## Example /// /// ``` /// use sync::{RWLock, Arc}; @@ -317,7 +317,7 @@ impl RWLock { /// Access the underlying data mutably. Locks the rwlock in write mode; /// other readers and writers will block. /// - /// # Failure + /// ## Failure /// /// Failing while inside the lock will unlock the lock while unwinding, so /// that other tasks won't block forever. As Mutex.lock, it will also poison @@ -345,7 +345,7 @@ impl RWLock { /// Access the underlying data immutably. May run concurrently with other /// reading tasks. /// - /// # Failure + /// ## Failure /// /// Failing will unlock the lock while unwinding. However, unlike all other /// access modes, this will not poison the lock. diff --git a/src/libsync/mutex.rs b/src/libsync/mutex.rs index 1aa84e8f8d149..474470a844d48 100644 --- a/src/libsync/mutex.rs +++ b/src/libsync/mutex.rs @@ -11,7 +11,7 @@ //! A proper mutex implementation regardless of the "flavor of task" which is //! acquiring the lock. -// # Implementation of Rust mutexes +// ## Implementation of Rust mutexes // // Most answers to the question of "how do I use a mutex" are "use pthreads", // but for Rust this isn't quite sufficient. Green threads cannot acquire an OS @@ -85,7 +85,7 @@ pub static NATIVE_BLOCKED: uint = 1 << 2; /// available. The mutex can also be statically initialized or created via a /// `new` constructor. /// -/// # Example +/// ## Example /// /// ```rust /// use sync::mutex::Mutex; @@ -122,7 +122,7 @@ enum Flavor { /// to a `Mutex`, a `destroy` method. This method is unsafe to call, and /// documentation can be found directly on the method. /// -/// # Example +/// ## Example /// /// ```rust /// use sync::mutex::{StaticMutex, MUTEX_INIT}; diff --git a/src/libsync/one.rs b/src/libsync/one.rs index 6fad2c8aa404d..4cd59e7723f34 100644 --- a/src/libsync/one.rs +++ b/src/libsync/one.rs @@ -25,7 +25,7 @@ use mutex::{StaticMutex, MUTEX_INIT}; /// functionality. This type can only be constructed with the `ONCE_INIT` /// value. /// -/// # Example +/// ## Example /// /// ```rust /// use sync::one::{Once, ONCE_INIT}; diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs index e7a2d3e063996..adb6dc125b4d9 100644 --- a/src/libsync/raw.rs +++ b/src/libsync/raw.rs @@ -216,7 +216,7 @@ pub struct Condvar<'a> { impl<'a> Condvar<'a> { /// Atomically drop the associated lock, and block until a signal is sent. /// - /// # Failure + /// ## Failure /// /// A task which is killed while waiting on a condition variable will wake /// up, fail, and unlock the associated lock as it unwinds. @@ -367,7 +367,7 @@ pub struct SemaphoreGuard<'a> { impl Semaphore { /// Create a new semaphore with the specified count. /// - /// # Failure + /// ## Failure /// /// This function will fail if `count` is negative. pub fn new(count: int) -> Semaphore { @@ -396,7 +396,7 @@ impl Semaphore { /// A blocking, bounded-waiting, mutual exclusion lock with an associated /// FIFO condition variable. /// -/// # Failure +/// ## Failure /// A task which fails while holding a mutex will unlock the mutex as it /// unwinds. pub struct Mutex { @@ -443,7 +443,7 @@ impl Mutex { /// A blocking, no-starvation, reader-writer lock with an associated condvar. /// -/// # Failure +/// ## Failure /// /// A task which fails while holding an rwlock will unlock the rwlock as it /// unwinds. @@ -514,7 +514,7 @@ impl RWLock { /// method on the returned guard. Additionally, the guard will contain a /// `Condvar` attached to this lock. /// - /// # Example + /// ## Example /// /// ```rust /// use sync::raw::RWLock; diff --git a/src/libsync/spsc_queue.rs b/src/libsync/spsc_queue.rs index 0cda1098ab447..d44918c131d6c 100644 --- a/src/libsync/spsc_queue.rs +++ b/src/libsync/spsc_queue.rs @@ -88,7 +88,7 @@ impl Queue { /// Creates a new queue. The producer returned is connected to the consumer /// to push all data to the consumer. /// - /// # Arguments + /// ## Arguments /// /// * `bound` - This queue implementation is implemented with a linked /// list, and this means that a push is always a malloc. In diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 871f277a2da28..6550c703174d0 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -79,7 +79,7 @@ //! enums (one for each variant). For empty struct and empty enum //! variants, it is represented as a count of 0. //! -//! # Examples +//! ## Examples //! //! The following simplified `PartialEq` is used for in-code examples: //! diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 13d2a632f3638..962624c8f2f36 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -10,7 +10,7 @@ //! The Rust parser and macro expander. //! -//! # Note +//! ## Note //! //! This API is completely unstable and subject to change. diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0116518d537a7..b31b6a7c43a2e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4643,7 +4643,7 @@ impl<'a> Parser<'a> { /// Parse extern crate links /// - /// # Example + /// ## Example /// /// extern crate url; /// extern crate foo = "bar"; @@ -4689,7 +4689,7 @@ impl<'a> Parser<'a> { /// `extern` is expected to have been /// consumed before calling this method /// - /// # Examples: + /// ## Examples: /// /// extern "C" {} /// extern {} diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 1410f225a298b..4c89bb863b8e7 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -80,7 +80,7 @@ impl Variables { /** Expand a parameterized capability - # Arguments + ## Arguments * `cap` - string to expand * `params` - vector of params for %p1 etc * `vars` - Variables struct for %Pa etc diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 46e2ca03ef6ed..bcef6612f43e2 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1118,7 +1118,7 @@ impl MetricMap { /// Load MetricDiff from a file. /// - /// # Failure + /// ## Failure /// /// This function will fail if the path does not exist or the path does not /// contain a valid metric map. diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index c923799e812ff..99a58e7834a52 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! # The Unicode Library +//! ## The Unicode Library //! //! Unicode-intensive functions for `char` and `str` types. //! diff --git a/src/libunicode/u_char.rs b/src/libunicode/u_char.rs index a927c364ff928..ccfd1abb979ed 100644 --- a/src/libunicode/u_char.rs +++ b/src/libunicode/u_char.rs @@ -105,7 +105,7 @@ pub fn is_digit(c: char) -> bool { /// A full reference can be found here /// http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992 /// -/// # Return value +/// ## Return value /// /// Returns the char itself if no conversion was made #[inline] @@ -118,7 +118,7 @@ pub fn to_uppercase(c: char) -> char { /// The case-folding performed is the common or simple mapping /// see `to_uppercase` for references and more information /// -/// # Return value +/// ## Return value /// /// Returns the char itself if no conversion if possible #[inline] @@ -201,7 +201,7 @@ pub trait UnicodeChar { /// The case-folding performed is the common or simple mapping. See /// `to_uppercase()` for references and more information. /// - /// # Return value + /// ## Return value /// /// Returns the lowercase equivalent of the character, or the character /// itself if no conversion is possible. @@ -217,7 +217,7 @@ pub trait UnicodeChar { /// /// A full reference can be found here [2]. /// - /// # Return value + /// ## Return value /// /// Returns the uppercase equivalent of the character, or the character /// itself if no conversion was made. diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 2e656a5a420d3..861bde76dad12 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -42,7 +42,7 @@ pub trait UnicodeStrSlice<'a> { /// [UAX#29](http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) /// recommends extended grapheme cluster boundaries for general processing. /// - /// # Example + /// ## Example /// /// ```rust /// let gr1 = "a\u0310e\u0301o\u0308\u0332".graphemes(true).collect::>(); @@ -55,7 +55,7 @@ pub trait UnicodeStrSlice<'a> { /// Returns an iterator over the grapheme clusters of self and their byte offsets. /// See `graphemes()` method for more information. /// - /// # Example + /// ## Example /// /// ```rust /// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::>(); @@ -67,7 +67,7 @@ pub trait UnicodeStrSlice<'a> { /// by any sequence of whitespace). Sequences of whitespace are /// collapsed, so empty "words" are not included. /// - /// # Example + /// ## Example /// /// ```rust /// let some_words = " Mary had\ta little \n\t lamb"; @@ -80,7 +80,7 @@ pub trait UnicodeStrSlice<'a> { /// /// Whitespace characters are determined by `char::is_whitespace`. /// - /// # Example + /// ## Example /// /// ```rust /// assert!(" \t\n".is_whitespace()); @@ -95,7 +95,7 @@ pub trait UnicodeStrSlice<'a> { /// /// Alphanumeric characters are determined by `char::is_alphanumeric`. /// - /// # Example + /// ## Example /// /// ```rust /// assert!("Löwe老虎Léopard123".is_alphanumeric()); diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs index b95fc3c495eed..d7390fc8b3c94 100644 --- a/src/liburl/lib.rs +++ b/src/liburl/lib.rs @@ -32,7 +32,7 @@ use std::path::BytesContainer; /// Identifier) that includes network location information, such as hostname or /// port number. /// -/// # Example +/// ## Example /// /// ```rust /// use url::Url; @@ -101,10 +101,10 @@ impl Url { /// Parses a URL, converting it from a string to a `Url` representation. /// - /// # Arguments + /// ## Arguments /// * rawurl - a string representing the full URL, including scheme. /// - /// # Return value + /// ## Return value /// /// `Err(e)` if the string did not represent a valid URL, where `e` is a /// `String` error message. Otherwise, `Ok(u)` where `u` is a `Url` struct @@ -153,10 +153,10 @@ impl Path { /// Parses a URL path, converting it from a string to a `Path` representation. /// - /// # Arguments + /// ## Arguments /// * rawpath - a string representing the path component of a URL. /// - /// # Return value + /// ## Return value /// /// `Err(e)` if the string did not represent a valid URL path, where `e` is a /// `String` error message. Otherwise, `Ok(p)` where `p` is a `Path` struct @@ -211,7 +211,7 @@ fn encode_inner(c: T, full_url: bool) -> String { /// /// This function is compliant with RFC 3986. /// -/// # Example +/// ## Example /// /// ```rust /// use url::encode; @@ -238,7 +238,7 @@ pub type DecodeResult = Result; /// /// This will only decode escape sequences generated by `encode`. /// -/// # Example +/// ## Example /// /// ```rust /// use url::decode; @@ -425,7 +425,7 @@ fn query_from_str(rawquery: &str) -> DecodeResult { /// Converts an instance of a URI `Query` type to a string. /// -/// # Example +/// ## Example /// /// ```rust /// let query = vec![("title".to_string(), "The Village".to_string()), @@ -450,7 +450,7 @@ pub fn query_to_str(query: &Query) -> String { /// /// Does not include the separating `:` character. /// -/// # Example +/// ## Example /// /// ```rust /// use url::get_scheme; @@ -719,7 +719,7 @@ impl FromStr for Path { impl fmt::Show for Url { /// Converts a URL from `Url` to string representation. /// - /// # Returns + /// ## Returns /// /// A string that contains the formatted URL. Note that this will usually /// be an inverse of `from_str` but might strip out unneeded separators; diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs index 0e29e6215032a..c2b2730795093 100644 --- a/src/libuuid/lib.rs +++ b/src/libuuid/lib.rs @@ -203,7 +203,7 @@ impl Uuid { /// Creates a UUID using the supplied field values /// - /// # Arguments + /// ## Arguments /// * `d1` A 32-bit word /// * `d2` A 16-bit word /// * `d3` A 16-bit word @@ -229,7 +229,7 @@ impl Uuid { /// Creates a UUID using the supplied bytes /// - /// # Arguments + /// ## Arguments /// * `b` An array or slice of 16 bytes pub fn from_bytes(b: &[u8]) -> Option { if b.len() != 16 {