vec-arena

Crates.iovec-arena
lib.rsvec-arena
version1.2.0
sourcesrc
created_at2016-11-14 23:26:10.272717
updated_at2021-05-08 21:40:01.805732
descriptionA simple object arena
homepage
repositoryhttps://github.com/smol-rs/vec-arena
max_upload_size
id7253
size49,338
admins (github:smol-rs:admins)

documentation

https://docs.rs/vec-arena

README

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>:

Commit count: 72

cargo fmt