12 releases (2 stable)

1.1.0 Mar 20, 2021
1.0.0 Sep 7, 2020
0.5.2 Aug 20, 2020
0.5.0 Jul 7, 2020
0.1.1 Nov 14, 2016

#4 in Memory management

Download history 32464/week @ 2020-12-25 44895/week @ 2021-01-01 55262/week @ 2021-01-08 57142/week @ 2021-01-15 60607/week @ 2021-01-22 63761/week @ 2021-01-29 60669/week @ 2021-02-05 63201/week @ 2021-02-12 70058/week @ 2021-02-19 70997/week @ 2021-02-26 68114/week @ 2021-03-05 69285/week @ 2021-03-12 70880/week @ 2021-03-19 74350/week @ 2021-03-26 66438/week @ 2021-04-02 63411/week @ 2021-04-09

251,289 downloads per month
Used in 1,268 crates (4 directly)

Apache-2.0 OR MIT

22KB
300 lines

vec-arena

Build Status License Cargo Documentation

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:

  1. Use unsafe code to escape Rust's ownership rules.
  2. Wrap every object in Rc<RefCell<T>>.
  3. 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>:

No runtime deps