mirror of https://github.com/smol-rs/vec-arena
ebc092e554
Deprecate in favor of slab |
||
---|---|---|
.github/workflows | ||
examples | ||
src | ||
tests | ||
.gitignore | ||
CHANGELOG.md | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |
README.md
vec-arena (deprecated)
This crate is now deprecated in favor of slab.
What is this?
A simple object arena.
You want to build a doubly linked list? Or maybe a bidirectional tree? Perhaps an even more complicated object graph?
Managing ownership and lifetimes might be tough then. Your options boil down to:
- Use unsafe code to escape Rust's ownership rules.
- Wrap every object in
Rc<RefCell<T>>
. - Use
Vec<T>
to store objects, then access them using indices.
If the last option seems most appealing to you, perhaps Arena<T>
is for you.
It will provide a more convenient API than a plain Vec<T>
.
Examples
Some data structures built using Arena<T>
: