Plushy
Plushy is a comfy generational arena for arbitrary types. You can think of it
as thunderdome for all types at once, or as
an ECS where you can only have one component at a time.
Plushy is a relatively simple crate that builds on top of thunderdome, but adds a few nice things, specificaly:
- Strongly typed wrappers around
Index, meaning you can't accidentally mix up your entity ids. If you insert aPlayer, the corresponding id isId<Player>. - You only need one
Storefor all of your types. Withthunderdomeyou'd need to create a separateArena<T>for every typeTyou want to store.
let mut store = new;
store.spawn;
store.spawn;
// Store the player's ID for later
let player = store.spawn;
assert_eq!;
// Fetch the player based on the ID. Note we don't need to write
// `store.get::<Player>(player)`, the type is inferred from the
// strongly typed ID.
assert_eq!;
// Change player health
store.get_mut.unwrap.health = 200.0;
// Fetch it again and verify the change.
assert_eq!;
License
Plushy is free and open source and dual licensed under MIT and Apache 2.0 licenses.