#game #slotmap #storage

swamp-slot-map

minimal slot map using index and generation

1 unstable release

0.0.9 Nov 9, 2024

#2679 in Game dev

23 downloads per month

MIT license

7KB
133 lines

swamp-slot-map 🐊

swamp-slot-map is a fast, efficient, and flexible slot map implementation in Rust. A slot map is a data structure that stores values indexed by unique handles, with support for efficient insertion, removal, and iteration. It is commonly used in systems that need to manage collections of items dynamically, such as games or simulations.

✨ Features

  • Efficient Indexing: A slot map provides efficient lookups, insertions, and deletions by using indices and a generation counter.
  • Handle-Based Access: Items are accessed using handles, making it safe to insert and remove elements without worrying about invalid indices.
  • Iterators: Supports both immutable and mutable iteration over stored items.
  • Generational Handling: Ensures that handles are valid by tracking the generation of each index, preventing access to stale or removed items.
  • Thread Safety: Can be adapted for thread-safe usage with additional synchronization.

📦 Installation

To use swamp-slot-map, add it to your Cargo.toml:

[dependencies]
swamp-slot-map = "0.0.9"

License

This project is licensed under the MIT License - see the LICENSE file for details.

No runtime deps