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
This commit is contained in:
parent
89ac8654e1
commit
2a23e6e277
@ -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
|
||||
|
@ -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> {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user