rust/std/collections
Prev: std | Up: std | Next: smart_pointers
Rel: rust/builtins, Ownership & Internals
Ref: Rust std — collections
Tags: #public #prog #rust #stdlib #collections #index
Import
use std::collections::{HashMap, HashSet, BTreeMap, VecDeque, BinaryHeap};
Overview
Hash-based, ordered B-Tree, ring-buffer, and priority-queue standard containers.
Core (#tier/core)
- `HashMap` — SwissTable hash map with DoS-resistant SipHash by default and ergonomic
.entry()API. - `HashSet` — Hash set backed by
HashMap<T, ()>with $O(1)$ membership and.union()/.intersection().
Standard (#tier/standard)
- `BTreeMap` — Sorted B-Tree map supporting $O(\log n)$ lookups and fast
.range(a..b)queries. - `VecDeque` — Double-ended growable ring buffer with $O(1)$
push_front/pop_front/push_back. - `BinaryHeap` — Array-backed max-heap priority queue ($O(\log n)$ push/pop, $O(1)$ peek).
Linked from
Related notes
- tuts/rust/std Linked here; links to this page; shared tags: #index, #prog, #rust, #stdlib
- tuts/rust/std/collections/BinaryHeap Linked here; links to this page; shared tags: #collections, #prog, #rust, #stdlib
- tuts/rust/std/collections/BTreeMap Linked here; links to this page; shared tags: #collections, #prog, #rust, #stdlib
- tuts/rust/std/collections/HashMap Linked here; links to this page; shared tags: #collections, #prog, #rust, #stdlib
- tuts/rust/std/collections/HashSet Linked here; links to this page; shared tags: #collections, #prog, #rust, #stdlib
- tuts/rust/std/collections/VecDeque Linked here; links to this page; shared tags: #collections, #prog, #rust, #stdlib
- tuts/rust/std/smart_pointers Linked here; links to this page; shared tags: #index, #prog, #rust, #stdlib
- tuts/rust/builtins Linked here; shared tags: #index, #prog, #rust
- tuts/rust/ownership_and_internals Linked here; shared tags: #index, #prog, #rust
- tuts/rust/std/error_and_fmt shared tags: #index, #prog, #rust, #stdlib