Map-of-indexes
A small utility crate when you have a list of unique but not dense indexes for which to each you want to associates a value.
In the documentation the indexes are referred as key
. Not an indexed map!
It can be considered a slower but more compact version of BTreeMap
.
Examples
A brief example of the crate's capacities
use ;
let v = vec!;
let mut map: = v.try_into?;
map.push;
let push_res = map.push_checked;
assert_eq!;
let old_key_value = map.set?;
assert_eq!;
assert_eq!;
CombinedKeyValue
is a compact representation when you need to save space.
use ;
// We have keys that take up to 40 bits, and value up to 24;
// Using (u64, u64) would have wasted 8 byte per entry.
type CombinedU64 = ;
safety_check; // ensure that key and value size fit on the unsigned integer.
let v = vec!;
let map: = v.try_into?;
let inner_raw: = Vec from_iter;
assert_eq!;
For an even more compact representation, consider using the bitvec
crate.
License: AGPL-3.0+