|
26 | 26 | //! should be considered. Detailed discussions of strengths and weaknesses of
|
27 | 27 | //! individual collections can be found on their own documentation pages.
|
28 | 28 | //!
|
29 |
| -//! ### Use a `Vec` when: |
| 29 | +//! ### Use a [`Vec`] when: |
30 | 30 | //! * You want to collect items up to be processed or sent elsewhere later, and
|
31 | 31 | //! don't care about any properties of the actual values being stored.
|
32 | 32 | //! * You want a sequence of elements in a particular order, and will only be
|
|
35 | 35 | //! * You want a resizable array.
|
36 | 36 | //! * You want a heap-allocated array.
|
37 | 37 | //!
|
38 |
| -//! ### Use a `VecDeque` when: |
| 38 | +//! ### Use a [`VecDeque`] when: |
39 | 39 | //! * You want a [`Vec`] that supports efficient insertion at both ends of the
|
40 | 40 | //! sequence.
|
41 | 41 | //! * You want a queue.
|
42 | 42 | //! * You want a double-ended queue (deque).
|
43 | 43 | //!
|
44 |
| -//! ### Use a `LinkedList` when: |
| 44 | +//! ### Use a [`LinkedList`] when: |
45 | 45 | //! * You want a [`Vec`] or [`VecDeque`] of unknown size, and can't tolerate
|
46 | 46 | //! amortization.
|
47 | 47 | //! * You want to efficiently split and append lists.
|
48 | 48 | //! * You are *absolutely* certain you *really*, *truly*, want a doubly linked
|
49 | 49 | //! list.
|
50 | 50 | //!
|
51 |
| -//! ### Use a `HashMap` when: |
| 51 | +//! ### Use a [`HashMap`] when: |
52 | 52 | //! * You want to associate arbitrary keys with an arbitrary value.
|
53 | 53 | //! * You want a cache.
|
54 | 54 | //! * You want a map, with no extra functionality.
|
55 | 55 | //!
|
56 |
| -//! ### Use a `BTreeMap` when: |
| 56 | +//! ### Use a [`BTreeMap`] when: |
57 | 57 | //! * You want a map sorted by its keys.
|
58 | 58 | //! * You want to be able to get a range of entries on-demand.
|
59 | 59 | //! * You're interested in what the smallest or largest key-value pair is.
|
|
65 | 65 | //! * There is no meaningful value to associate with your keys.
|
66 | 66 | //! * You just want a set.
|
67 | 67 | //!
|
68 |
| -//! ### Use a `BinaryHeap` when: |
| 68 | +//! ### Use a [`BinaryHeap`] when: |
69 | 69 | //!
|
70 | 70 | //! * You want to store a bunch of elements, but only ever want to process the
|
71 | 71 | //! "biggest" or "most important" one at any given time.
|
|
0 commit comments