13 releases (3 stable)

1.2.0 May 8, 2021
1.1.0 Mar 20, 2021
1.0.0 Sep 7, 2020
0.5.2 Aug 20, 2020
0.1.1 Nov 14, 2016

#11 in Memory management

Download history 75440/week @ 2021-04-07 70548/week @ 2021-04-14 64619/week @ 2021-04-21 49045/week @ 2021-04-28 43693/week @ 2021-05-05 35754/week @ 2021-05-12 32151/week @ 2021-05-19 31912/week @ 2021-05-26 29453/week @ 2021-06-02 28187/week @ 2021-06-09 28426/week @ 2021-06-16 23043/week @ 2021-06-23 24148/week @ 2021-06-30 22578/week @ 2021-07-07 23234/week @ 2021-07-14 22240/week @ 2021-07-21

274,832 downloads per month
Used in 23 crates (via synchrotron)

Apache-2.0 OR MIT

22KB
304 lines

vec-arena (deprecated)

Build License Cargo Documentation

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:

  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