Documentation Crates.io

stadium provides the [Stadium] structure. This datastructure allows you to allocate any given set of objects (that can be of different types) in a continuous chunk of the memory.

Example

```rust // The first step is to build the stadium using a builder. // This registers the data that will be used inside of the stadium. let mut builder = stadium::builder();

let hvec = builder.insert(vec![2019, 2020, 2021]); let hstr = builder.insert("Hello, world!"); let hinta = builder.insert(68u64); let hintb = builder.insert(65u64)

// Once the initialization is done, the actual stadium can be created. let mut stadium = builder.build();

// Values can be retrieved. asserteq!(&stadium[hvec], &[2019, 2020, 2021][..]); asserteq!(stadium[hstr], "Hello, world!"); asserteq!(stadium[hint_a], 68);

// Or mutated. stadium[hvec].push(2022); stadium[hint_b] = 70;

// Other operations are supported. asserteq!(stadium.replace(hstr, "FOOBAR"), "Hello, world!");

stadium.swap(hinta, hintb); asserteq!(stadium[hinta], 70); asserteq!(stadium[hintb], 68); ```