Crate obj_pool

Source
Expand description

A simple object pool.

ObjPool<T> is basically just a Vec<Option<T>>, which allows you to:

  • Insert an object (reuse an existing None element, or append to the end) and get an ObjId in return.
  • Remove object with a specified ObjId.
  • Access object with a specified ObjId.
  • Convert ObjId to index and back for specified ObjPool.

§Limitations:

  • ObjId is always 32-bit long.

§Examples

Some data structures built using ObjPool<T>:

Structs§

IntoIter
An iterator over the occupied slots in a ObjPool.
Iter
An iterator over references to the occupied slots in a ObjPool.
IterMut
An iterator over mutable references to the occupied slots in a Arena.
ObjId
An id of the object in an ObjPool.
ObjPool
An object pool.
ParObjPool