#key #newtype #structs #integer #enums #key-value #idmap

macro idmap-derive

Automaticatically derives IntegerId for the idmap crate

3 releases

0.1.2 May 16, 2020
0.1.1 Feb 19, 2018
0.1.0 Aug 16, 2017

#79 in #newtype

Download history 149/week @ 2024-04-08 82/week @ 2024-04-15 23/week @ 2024-04-22 7/week @ 2024-04-29 13/week @ 2024-05-06 10/week @ 2024-05-13 23/week @ 2024-05-20 15/week @ 2024-05-27 81/week @ 2024-06-03 39/week @ 2024-06-10 22/week @ 2024-06-17 23/week @ 2024-06-24 19/week @ 2024-07-08 15/week @ 2024-07-15 40/week @ 2024-07-22

76 downloads per month
Used in idmap

MIT license

7KB
95 lines

rust-idmap Crates.io Documentation

Efficient maps of integer id keys to values, backed by an underlying Vec.

Features

  • Automiatically derived IntegerId for enums and newtype structs
    • Implemented in the idmap-derive proc_macro crate
  • 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.

Dependencies

~1.5MB
~36K SLoC