24 releases
0.2.21 | Sep 6, 2021 |
---|---|
0.2.19 | Jun 7, 2020 |
0.2.16 | Aug 24, 2018 |
0.2.14 | May 22, 2018 |
0.2.3 | Oct 29, 2017 |
#988 in Algorithms
272 downloads per month
84KB
2K
SLoC
rust-idmap
Efficient maps of integer id keys to values, backed by an underlying Vec
.
Features
- Compiles on stable rust
- I only officially support the latest stable ;)
- Automatically derived
IntegerId
for enums and newtype structs- Implemented in the
idmap-derive
proc_macro crate
- Implemented in the
- Maintains insertion order of the entries, as there's an indirection like
OrderMap
.- Therefore, entries which aren't present take little space, as only a
u32
needs to be stored. - This indirection can be avoided with a
DirectIdMap
which doesn't preserve order, and saves space when the ids of the map's keys are densly packed and mostly present.
- Therefore, entries which aren't present take little space, as only a
lib.rs
:
Efficient maps of integer id keys to values, backed by an underlying Vec
.
However, unless a CompactIdMap
is used, space requirements are O(n) the largest key.
Any type that implements IntegerId
can be used for the key,
but no storage is wasted if the key can be represented from the id.
Dependencies
~78–650KB
~11K SLoC