API reference Dodo 0.1.4

std/collections/hash_map

Public declarations, types, methods, and source contracts for std/collections/hash_map.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/collections/hash_map"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
block alloc/block hash_map.dodo
error alloc/error hash_map.dodo
layout alloc/layout hash_map.dodo
mem core/mem hash_map.dodo
ptr core/ptr hash_map.dodo

Entry

Struct · Source

pub struct Entry<K, V> {
    pub key: K
    pub value: V
}

Map

Struct · Source

Linear-probing map, power-of-two bucket count, maximum 75% load. H supplies hash(&K)->u64 and equal(&K,&K)->bool. Equal keys MUST hash equally.

pub struct Map<K, V, H, A> {
    // Private implementation fields omitted.
}

Map.next

Function · Source

The cursor is opaque traversal state; callers never inspect buckets.

pub fn next(&self, cursor: &mut usize) -> Option<&Entry<K, V>> from(self)

Map.len

Function · Source

pub fn len(&self) -> usize

Map.bucket_count

Function · Source

Bucket count for physical-order entry(index) traversal.

pub fn bucket_count(&self) -> usize

Map.capacity

Function · Source

pub fn capacity(&self) -> usize

Map.entry

Function · Source

pub fn entry(&self, index: usize) -> Option<&Entry<K, V>>

Map.contains

Function · Source

pub fn contains(&self, key: &K) -> bool

Map.get

Function · Source

pub fn get(&self, key: &K) -> Option<&V>

Map.get_mut

Function · Source

pub fn get_mut(&mut self, key: &K) -> Option<&mut V> requires_plain(K, V)

Map.try_update

Function · Source

Scoped value mutation; keys and bucket occupancy stay unchanged. M.apply(&mut V)->void!E cannot retain the temporary value borrow or introduce stored sources. Restore the bucket before propagating errors.

pub fn try_update<M, E>(&mut self, key: &K, mutation: &mut M) -> bool!E requires_plain(E)

Map.reserve

Function · Source

pub fn reserve(&mut self, additional: usize) -> void!error.AllocError

Map.insert

Function · Source

pub fn insert(&mut self, key: K, value: V) -> Option<V>!error.AllocError from(self.stored) stores(self, key, value)

Map.remove

Function · Source

pub fn remove(&mut self, key: &K) -> Option<V> from(self.stored)

Map.clear

Function · Source

pub fn clear(&mut self)

new

Function · Source

SAFETY: A obeys vector.new’s allocation/lifetime contract. No allocation yet.

pub unsafe fn new<K, V, H, A>(allocator: A, policy: H) -> Map<K, V, H, A> from(allocator, policy)

Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.

Type to search all documentation.

Keyboard shortcuts

Search documentation
Ctrl K or /
Move through results
↑ ↓
Open selected result
Enter
Close a dialog
Esc
Show these shortcuts
?