obj-pool

Crates.ioobj-pool
lib.rsobj-pool
version0.5.1
sourcesrc
created_at2018-08-17 23:10:37.781935
updated_at2022-10-07 08:58:58.242914
descriptionA simple object arena
homepage
repositoryhttps://github.com/artemshein/obj-pool
max_upload_size
id80010
size56,439
Artem Shein (artemshein)

documentation

https://docs.rs/obj-pool

README

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

Commit count: 70

cargo fmt