Vec<T>
: When you need a dynamic array-like structure, with random indexing by usize
, and efficient appending at the end.
String
: For owned, mutable text data.
HashMap<K, V>
: For fast lookups by arbitrary keys, remembering to use std::collections::HashMap
.
BTreeMap<K, V>
: For sorted key-value storage and O(log n) complexity.
HashSet<T>
and BTreeSet<T>
: For maintaining unique items.
VecDeque<T>
: For efficient insertion/removal at both ends.
LinkedList<T>
: For specific insertion/removal patterns where linked-list semantics are necessary.