Crates.io | compact-map |
lib.rs | compact-map |
version | 0.1.0 |
source | src |
created_at | 2024-04-18 11:08:19.320481 |
updated_at | 2024-04-18 11:08:19.320481 |
description | 'Small map' optimization: store up to a small number of key-value pairs on the stack. |
homepage | |
repository | https://github.com/lightsing/compact-map.git |
max_upload_size | |
id | 1212413 |
size | 113,809 |
'Small map' optimization: store up to a small number of key-value pairs on the stack.
Provides '1:1' API compatibility with std::collections::HashMap
.
use compact_map::CompactMap;
fn main() {
let mut map = CompactMap::default(); // default capacity is 16
// or you can specify the capacity
// let mut map: CompactMap<&str, i32, 32> = CompactMap::default();
map.insert("a", 1);
map.insert("b", 2);
}