about summary refs log tree commit diff
path: root/library/alloc/src/collections
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-03-18 00:28:07 +0100
committerGitHub <noreply@github.com>2021-03-18 00:28:07 +0100
commitc99200fa5370d1eecb16e29bd9e1ee9e1d844e8b (patch)
tree48906d3197ac1a282056bc684ad4687605f05493 /library/alloc/src/collections
parent16f6583f2d95b53610ee10073752e883dbfa24ea (diff)
parenta7491d932fdfe9ccb1950c1ab660c0bf493cc7bb (diff)
downloadrust-c99200fa5370d1eecb16e29bd9e1ee9e1d844e8b.tar.gz
rust-c99200fa5370d1eecb16e29bd9e1ee9e1d844e8b.zip
Rollup merge of #82434 - jyn514:hash, r=JohnTitor
Add more links between hash and btree collections

- Link from `core::hash` to `HashMap` and `HashSet`
- Link from HashMap and HashSet to the module-level documentation on
  when to use the collection
- Link from several collections to Wikipedia articles on the general
  concept

See also https://github.com/rust-lang/rust/pull/81989#issuecomment-783920840.
Diffstat (limited to 'library/alloc/src/collections')
-rw-r--r--library/alloc/src/collections/btree/map.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index 622983996aa..a0dbb289252 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -21,15 +21,15 @@ use Entry::*;
 /// We might temporarily have fewer elements during methods.
 pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
 
-// A tree in a `BTreeMap` is a tree in the `node` module with addtional invariants:
+// A tree in a `BTreeMap` is a tree in the `node` module with additional invariants:
 // - Keys must appear in ascending order (according to the key's type).
 // - If the root node is internal, it must contain at least 1 element.
 // - Every non-root node contains at least MIN_LEN elements.
 //
-// An empty map may be represented both by the absense of a root node or by a
+// An empty map may be represented both by the absence of a root node or by a
 // root node that is an empty leaf.
 
-/// A map based on a B-Tree.
+/// A map based on a [B-Tree].
 ///
 /// B-Trees represent a fundamental compromise between cache-efficiency and actually minimizing
 /// the amount of work performed in a search. In theory, a binary search tree (BST) is the optimal
@@ -63,6 +63,7 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
 /// undefined behavior. This could include panics, incorrect results, aborts, memory leaks, and
 /// non-termination.
 ///
+/// [B-Tree]: https://en.wikipedia.org/wiki/B-tree
 /// [`Cell`]: core::cell::Cell
 /// [`RefCell`]: core::cell::RefCell
 ///