std::map
std::map provides associative containers:
HashMap(K, V)(unordered, hash table),TreeMap(K, V)(ordered, red-black tree).
Full reference: map.
Notes#
- Supported forms: usable in Silk with documented limits.
- Full reference: map
Importing#
import std::map;
Examples#
Example: HashMap(u64, int) basic usage#
import std::map;
type Map = std::map::HashMap(u64, int);
fn main () -> int {
match (Map.init(16)) {
Ok(map) => {
let mut m: Map = map;
m.put(1, 10);
let v: int = m.get(1) ?? 0;
m.drop();
return v;
},
Err(_) => {
return 2;
},
}
}
See also#
Source repository · Edit this page · View Markdown