Thunderdome is a ~~gladitorial~~ generational arena inspired by
generational-arena,
slotmap, and
slab. It provides constant time insertion,
lookup, and removal via small (8 byte) keys returned from [Arena
].
Thunderdome's key type, [Index
], is still 8 bytes when put inside of an
Option<T>
thanks to Rust's NonZero*
types.
```rust let mut arena = Arena::new();
let foo = arena.insert("Foo"); let bar = arena.insert("Bar");
asserteq!(arena[foo], "Foo"); asserteq!(arena[bar], "Bar");
arena[bar] = "Replaced"; assert_eq!(arena[bar], "Replaced");
let foovalue = arena.remove(foo); asserteq!(foo_value, Some("Foo"));
// The slot previously used by foo will be reused for baz let baz = arena.insert("Baz"); assert_eq!(arena[baz], "Baz");
// foo is no longer a valid key assert_eq!(arena.get(foo), None); ```
| Feature | Thunderdome | generational-arena | slotmap | slab |
|------------------------------|-------------|--------------------|---------|------|
| Generational Indices¹ | Yes | Yes | Yes | No |
| size_of::<Index>()
| 8 | 16 | 8 | 8 |
| size_of::<Option<Index>>()
| 8 | 24 | 8 | 16 |
| Max Elements | 2³² | 2⁶⁴ | 2³² | 2⁶⁴ |
| Non-Copy
Values | Yes | Yes | Yes | Yes |
| no_std
Support | Yes | Yes | Yes | No |
| Serde Support | No | Yes | Yes | No |
1.44.0-x86_64-pc-windows-msvc
Thunderdome supports Rust 1.47.0 and newer. Until Thunderdome reaches 1.0, changes to the MSRV will require major version bumps. After 1.0, MSRV changes will only require minor version bumps, but will need significant justification.
std
(default): Use the standard library. Disable to make this crate no-std
compatible.Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.