11 releases

0.5.1 Oct 7, 2022
0.5.0 Jul 20, 2022
0.4.4 Apr 20, 2020
0.4.3 Sep 30, 2019
0.1.0 Aug 17, 2018

#278 in Memory management

47 downloads per month

Apache-2.0/MIT

44KB
840 lines

obj-pool

Build Status License 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 ObjPool<T> is for you. It will provide a more convenient API than a plain Vec<T>.

Examples

Some data structures built using ObjPool<T>:

Dependencies

~0.4–5MB
~15K SLoC