Struct mempool::Pool [] [src]

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

A fast memory pool.

Methods

impl<T: Send + 'static> Pool<T>
[src]

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>
[src]

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

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

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

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

Formats the value using the given formatter.