A Rust library providing three containers with persistent unique keys to access
DenseSlotMap. Upon insertion a key
is returned that can be used to later access or remove the values. Insertion,
deletion and access all take O(1) time with low overhead. Great for storing
collections of objects that need stable, safe references but have no clear
ownership otherwise, such as game entities or graph nodes. Two secondary maps,
SparseSecondaryMap are also provided that allow you to map
further objects to the keys created by one of the slot maps. Please refer to the
the documentation for more information.
The minimum required stable Rust version for
slotmap is 1.49. To start using
slotmap add the following to your
 = "1.0"
A short example:
use ; let mut sm = new; let foo = sm.insert; // Key generated on insert. let bar = sm.insert; assert_eq!; assert_eq!; sm.remove; let reuse = sm.insert; // Space from bar reused. assert_eq!; // After deletion a key stays invalid. let mut sec = new; sec.insert; // We provide the key for secondary maps. sec.insert; for in sm
slotmap is released under the Zlib license, a permissive license. It is
OSI and FSF approved and GPL compatible.