about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorlukaramu <lukaramu@users.noreply.github.com>2017-04-14 23:36:27 +0200
committerlukaramu <lukaramu@users.noreply.github.com>2017-04-14 23:36:27 +0200
commit2a23e6e277bc6a6a00c5e5d9d5a159265bef8c24 (patch)
treee94242d427893691034f433e09f8aacd238bcdad /src/libcollections
parent89ac8654e19b123132c82eb9f81ed3ba9bb3eb33 (diff)
std::collections docs: Address issues that came up in PR #41286
* 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
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/binary_heap.rs2
-rw-r--r--src/libcollections/lib.rs19
2 files changed, 20 insertions, 1 deletions
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs
index 89d9576cba2..149c285a72a 100644
--- a/src/libcollections/binary_heap.rs
+++ b/src/libcollections/binary_heap.rs
@@ -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
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index 4ff54095bd3..a207087915a 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -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};
@@ -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> {