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/ordered_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 |
|---|---|---|
error |
alloc/error |
ordered_map.dodo |
mem |
core/mem |
ordered_map.dodo |
vector |
std/collections/vector |
ordered_map.dodo |
Entry
Struct · Source
pub struct Entry<K, V> {
pub key: K
pub value: V
}
Map
Struct · Source
Sorted contiguous map: O(log n) lookups, O(n) insertion/removal, compact ordered iteration. C.compare(&K,&K)->i32 supplies a total ordering.
pub struct Map<K, V, C, A> {
// Private implementation fields omitted.
}
Map.next
Function · Source
Cursor starts at zero. Each call yields one logical element.
pub fn next(&self, cursor: &mut usize) -> Option<&Entry<K, V>> from(self)
Map.len
Function · Source
pub fn len(&self) -> usize
Map.capacity
Function · Source
pub fn capacity(&self) -> usize
Map.entries
Function · Source
pub fn entries(&self) -> &[Entry<K, V>]
Map.get
Function · Source
pub fn get(&self, key: &K) -> Option<&V>
Map.contains
Function · Source
pub fn contains(&self, key: &K) -> bool
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: allocator must satisfy vector.new’s capability contract.
pub unsafe fn new<K, V, C, A>(allocator: A, ordering: C) -> Map<K, V, C, A> from(allocator, ordering)
Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.