[][src]Crate thunderdome

GitHub CI Status thunderdome on crates.io thunderdome docs

Generational arena inspired by generational-arena, slotmap, and slab.

Basic Examples

let mut arena = Arena::new();

let foo = arena.insert("Foo");
let bar = arena.insert("Bar");

assert_eq!(arena[foo], "Foo");
assert_eq!(arena[bar], "Bar");

arena[bar] = "Replaced";
assert_eq!(arena[bar], "Replaced");

let foo_value = arena.remove(foo);
assert_eq!(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);

Comparison With Similar Crates

FeatureThunderdomegenerational-arenaslotmapslab
Generational IndicesYesYesYesNo
size_of::<Index>()161688
size_of::<Option<Index>>()1624816
Non-Copy ValuesYesYesSorta¹Yes
no-std supportNoYesNoNo
Serde supportNoYesYesNo
  • Sizes calculated on rustc 1.44.0-x86_64-pc-windows-msvc
  1. slotmap's SlotMap and HopSlotMap require values to be Copy on stable Rust versions. slotmap's DenseSlotMap type supports non-Copy types on stable, but has different performance trade-offs.

Minimum Supported Rust Version (MSRV)

Thunderdome supports Rust 1.31.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.

Structs

Arena

Container that can have elements inserted into it and removed from it.

Drain

See Arena::drain.

Index

Index type for Arena that has a generation attached to it.