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

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

#92 in #newtype

Download history 83/week @ 2024-11-16 74/week @ 2024-11-23 39/week @ 2024-11-30 89/week @ 2024-12-07 51/week @ 2024-12-14 43/week @ 2024-12-21 69/week @ 2024-12-28 71/week @ 2025-01-04 84/week @ 2025-01-11 106/week @ 2025-01-18 48/week @ 2025-01-25 59/week @ 2025-02-01 77/week @ 2025-02-08 56/week @ 2025-02-15 148/week @ 2025-02-22 178/week @ 2025-03-01

480 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
~38K SLoC