Crate maskerad_object_pool [] [src]

This library provides 2 object pools :

  • An object pool for single threaded scenarios.

  • An object pool for multi threaded scenarios.

An object pool is a collection of reusable objects, which are allocated in advance. We can ask an object if he's "alive".

When the pool is initialized, it creates the entire collection of objects and initialize them to the "not in use" state.

When you want a new object, you ask the pool to give the first "not in use" object. When you no longer need the object, the object goes back to the "not in use" state.

From the user's perspective, he creates(allocate) and destroys/drops(deallocate) objects, but no allocations occur.

Structs

AtomicHandler

A wrapper around a atomic reference-counted pointer to a PoolObject wrapped by a Mutex.

AtomicObjectPool

A wrapper around a vector of AtomicHandler.

Handler

A wrapper around a reference-counted pointer to a PoolObject with interior mutability.

ObjectPool

A wrapper around a vector of Handler.

PoolObject

A thin wrapper around an object, adding the usage state in an object-agnostic way.

Enums

PoolError

A custom error enumeration, used by PoolResult as the error type.

Type Definitions

PoolResult

A simple typedef, for convenience.