18.4 Other Collection Types in the Standard Library
Beyond Vec, String, and HashMap, the standard library offers more collections:
BTreeMap<K, V>: A balanced tree map with O(log n) operations and sorted keys.HashSet<T>andBTreeSet<T>: Store unique values.HashSetuses hashing (O(1) average),BTreeSetis tree-based (O(log n)) and sorted.VecDeque<T>: A double-ended queue allowing efficient insertion/removal at both ends.LinkedList<T>: A doubly linked list; efficient insertion/removal at known positions, but less cache-friendly thanVec.
All these types are generic, just like Vec<T> and HashMap<K, V>.