Struct mempool::Pool [] [src]

pub struct Pool<T: Send + 'static>(_);

A fast memory pool.

Methods

impl<T: Send + 'static> Pool<T>

fn new(create: CreateFn<T>) -> Pool<T>

Create a new memory pool with the given initialization function.

fn get(&self) -> Guard<T>

Get a new value from the pool.

If one does not exist, then it is created with the initialization function.

This returns a guard without any lifetime variables. In exchange, it has slightly larger overhead than get_ref.

When the guard is dropped, the underlying value is returned to the pool.

fn get_ref(&self) -> RefGuard<T>

Get a new value from the pool.

If one does not exist, then it is created with the initialization function.

This returns a guard with a borrowed reference to the underlying pool.

When the guard is dropped, the underlying value is returned to the pool.

Trait Implementations

impl<T: Send + 'static> Clone for Pool<T>

fn clone(&self) -> Pool<T>

fn clone_from(&mut self, source: &Self)

impl<T: Debug + Send + 'static> Debug for Pool<T>

fn fmt(&self, f: &mut Formatter) -> Result