pub struct Pool<M: Manager, W: From<Object<M>> = Object<M>> { /* private fields */ }
Expand description

A generic object and connection pool.

This struct can be cloned and transferred across thread boundaries and uses reference counting for its internal state.

Implementations

Create new connection pool with a given manager and max_size. The manager is used to create and recycle objects and max_size is the maximum number of objects ever created.

Create new connection pool with a given manager and config. The manager is used to create and recycle objects. The config specifies the maximum numbers of objects to be created and timeouts.

Retrieve object from pool or wait for one to become available.

Retrieve object from the pool and do not wait if there is currently no object available and the maximum pool size has been reached.

Retrieve object using a different timeout config than the one configured.

Close the pool

All current and future tasks waiting for objects return Err(PoolError::Closed) immediately.

Returns true if the pool has been closed

Retrieve status of the pool

Get manager of the pool

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.