Skip to content

Commit 685332c

Browse files
committed
Auto merge of #27998 - birkenfeld:patch-1, r=alexcrichton
These have been removed and should not be documented here. Should the replacement crates on crates.io be linked to, or is that not wanted in the core docs?
2 parents ef3255b + fc7c0f9 commit 685332c

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

src/libstd/collections/mod.rs

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
//!
2626
//! Rust's collections can be grouped into four major categories:
2727
//!
28-
//! * Sequences: `Vec`, `VecDeque`, `LinkedList`, `BitVec`
29-
//! * Maps: `HashMap`, `BTreeMap`, `VecMap`
30-
//! * Sets: `HashSet`, `BTreeSet`, `BitSet`
28+
//! * Sequences: `Vec`, `VecDeque`, `LinkedList`
29+
//! * Maps: `HashMap`, `BTreeMap`
30+
//! * Sets: `HashSet`, `BTreeSet`
3131
//! * Misc: `BinaryHeap`
3232
//!
3333
//! # When Should You Use Which Collection?
@@ -70,22 +70,11 @@
7070
//! * You want to be able to get all of the entries in order on-demand.
7171
//! * You want a sorted map.
7272
//!
73-
//! ### Use a `VecMap` when:
74-
//! * You want a `HashMap` but with known to be small `usize` keys.
75-
//! * You want a `BTreeMap`, but with known to be small `usize` keys.
76-
//!
7773
//! ### Use the `Set` variant of any of these `Map`s when:
7874
//! * You just want to remember which keys you've seen.
7975
//! * There is no meaningful value to associate with your keys.
8076
//! * You just want a set.
8177
//!
82-
//! ### Use a `BitVec` when:
83-
//! * You want to store an unbounded number of booleans in a small space.
84-
//! * You want a bit vector.
85-
//!
86-
//! ### Use a `BitSet` when:
87-
//! * You want a `BitVec`, but want `Set` properties
88-
//!
8978
//! ### Use a `BinaryHeap` when:
9079
//!
9180
//! * You want to store a bunch of elements, but only ever want to process the
@@ -123,31 +112,20 @@
123112
//! | Vec | O(1) | O(n-i)* | O(n-i) | O(m)* | O(n-i) |
124113
//! | VecDeque | O(1) | O(min(i, n-i))* | O(min(i, n-i)) | O(m)* | O(min(i, n-i)) |
125114
//! | LinkedList | O(min(i, n-i)) | O(min(i, n-i)) | O(min(i, n-i)) | O(1) | O(min(i, n-i)) |
126-
//! | BitVec | O(1) | O(n-i)* | O(n-i) | O(m)* | O(n-i) |
127115
//!
128116
//! Note that where ties occur, Vec is generally going to be faster than VecDeque, and VecDeque
129-
//! is generally going to be faster than LinkedList. BitVec is not a general purpose collection, and
130-
//! therefore cannot reasonably be compared.
117+
//! is generally going to be faster than LinkedList.
131118
//!
132119
//! ## Maps
133120
//!
134-
//! For Sets, all operations have the cost of the equivalent Map operation. For
135-
//! BitSet,
136-
//! refer to VecMap.
121+
//! For Sets, all operations have the cost of the equivalent Map operation.
137122
//!
138123
//! | | get | insert | remove | predecessor |
139124
//! |----------|-----------|----------|----------|-------------|
140125
//! | HashMap | O(1)~ | O(1)~* | O(1)~ | N/A |
141126
//! | BTreeMap | O(log n) | O(log n) | O(log n) | O(log n) |
142-
//! | VecMap | O(1) | O(1)? | O(1) | O(n) |
143-
//!
144-
//! Note that VecMap is *incredibly* inefficient in terms of space. The O(1)
145-
//! insertion time assumes space for the element is already allocated.
146-
//! Otherwise, a large key may require a massive reallocation, with no direct
147-
//! relation to the number of elements in the collection. VecMap should only be
148-
//! seriously considered for small keys.
149127
//!
150-
//! Note also that BTreeMap's precise performance depends on the value of B.
128+
//! Note that BTreeMap's precise performance depends on the value of B.
151129
//!
152130
//! # Correct and Efficient Usage of Collections
153131
//!

0 commit comments

Comments
 (0)