Crate mempool [] [src]

This crate provides a fast thread safe memory pool for reusing allocations.

Example

A pool takes an initialization function for creating members of the pool. Once created, values can be immediately retrieved. Once the value is dropped, it is returned to the pool for reuse.

use mempool::Pool;

let pool = Pool::new(Box::new(|| "foobar"));
assert_eq!("foobar", *pool.get());

Structs

Pool

A fast memory pool.

PoolGuard

A guard for putting values back into the pool on drop.

Type Definitions

CreateFn

The type of an initialization function.