Skip to content

Commit

Permalink
std::collections docs: Address issues that came up in PR #41286
Browse files Browse the repository at this point in the history
* Bound:
  * Added another example using RangeArgument to illustrate how Bound maps
    to range endpoints.
  * Added a note to the existing example that says that it's better to use
    range syntax in most cases
  * Added missing /// line
* binary_heap::PeakMut: s/Object representing/Structure wrapping
* added collections/hash_set/struct.HashSet.html to linkchecker whitelist
  • Loading branch information
lukaramu committed Apr 14, 2017
1 parent 89ac865 commit 2a23e6e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libcollections/binary_heap.rs
Expand Up @@ -219,7 +219,7 @@ pub struct BinaryHeap<T> {
data: Vec<T>,
}

/// Object representing a mutable reference to the greatest item on a
/// Structure wrapping a mutable reference to the greatest item on a
/// `BinaryHeap`.
///
/// This `struct` is created by the [`peek_mut`] method on [`BinaryHeap`]. See
Expand Down
19 changes: 19 additions & 0 deletions src/libcollections/lib.rs
Expand Up @@ -135,8 +135,25 @@ mod std {
}

/// An endpoint of a range of keys.
///
/// # Examples
///
/// `Bound`s are range endpoints:
///
/// ```
/// #![feature(collections_range)]
///
/// use std::collections::range::RangeArgument;
/// use std::collections::Bound::*;
///
/// assert_eq!((..100).start(), Unbounded);
/// assert_eq!((1..12).start(), Included(&1));
/// assert_eq!((1..12).end(), Excluded(&12));
/// ```
///
/// Using a tuple of `Bound`s as an argument to [`BTreeMap::range`].
/// Note that in most cases, it's better to use range syntax (`1..5`) instead.
///
/// ```
/// use std::collections::BTreeMap;
/// use std::collections::Bound::{Excluded, Included, Unbounded};
Expand All @@ -152,6 +169,8 @@ mod std {
///
/// assert_eq!(Some((&3, &"a")), map.range((Unbounded, Included(5))).next());
/// ```
///
/// [`BTreeMap::range`]: btree_map/struct.BTreeMap.html#method.range
#[stable(feature = "collections_bound", since = "1.17.0")]
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
pub enum Bound<T> {
Expand Down
3 changes: 2 additions & 1 deletion src/tools/linkchecker/main.rs
Expand Up @@ -142,7 +142,8 @@ fn check(cache: &mut Cache,
if file.ends_with("btree_set/struct.BTreeSet.html") ||
file.ends_with("collections/struct.BTreeSet.html") ||
file.ends_with("collections/btree_map/struct.BTreeMap.html") ||
file.ends_with("collections/hash_map/struct.HashMap.html") {
file.ends_with("collections/hash_map/struct.HashMap.html") ||
file.ends_with("collections/hash_set/struct.HashSet.html") {
return None;
}

Expand Down

0 comments on commit 2a23e6e

Please sign in to comment.