10 unstable releases (4 breaking)

Uses new Rust 2024

0.5.0 Oct 30, 2025
0.3.0 Aug 28, 2025
0.2.5 Jul 8, 2025
0.2.3 Jan 7, 2025
0.2.1 Oct 31, 2024

#165 in Data structures

Download history 2453/week @ 2025-07-27 2767/week @ 2025-08-03 2892/week @ 2025-08-10 1811/week @ 2025-08-17 2033/week @ 2025-08-24 2072/week @ 2025-08-31 1686/week @ 2025-09-07 2090/week @ 2025-09-14 2240/week @ 2025-09-21 2797/week @ 2025-09-28 2559/week @ 2025-10-05 3171/week @ 2025-10-12 2733/week @ 2025-10-19 3363/week @ 2025-10-26 3282/week @ 2025-11-02 2378/week @ 2025-11-09

12,013 downloads per month
Used in 65 crates (6 directly)

MIT/Apache

51KB
834 lines

slotmap-careful: Wrapper for slotmap generational arena to prevent key reuse.

The slotmap generational arena implementation is efficient and easy to use. Unfortunately, it has a behavior where if a single index slot is reused about 2^31 times, its version field will wrap around, and the same key will be returned twice. This can lead to security problems in programs that rely on each for a slotmap being permanently unique.

This crate implement a wrapper around slotmap::SlotMap to prevent key reuse. It works by noticing when any slot with a very high version counter is about to become empty, and instead marking such slots as permanently unusable.

Note that this new behavior can result in memory usage that grows slowly over time, even if the actual capacity of the slotmap remains low.

Dependencies

~0.6–1.3MB
~27K SLoC