Skip to content
masterclass Buddy

Rust · Class

HashMap

HashMap stores values by key. Keys must implement Eq and Hash, and equal keys must have equal hashes. Its default hasher is randomly seeded to help resist collision-based attacks.

Last updated

Since
1.0.0

Syntax

pub struct HashMap<K, V, S = RandomState, A: Allocator = Global>

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • HashMap::new
  • HashMap::with_capacity
  • HashMap::insert
  • HashMap::get
  • HashMap::contains_key
  • HashMap::remove
  • HashMap::entry
  • HashMap::keys

Source: HashMap in std::collections - Rust. Checked 2026-11-03.