pub struct Pool<T> { /* private fields */ }
Available on crate feature unmanaged only.
Expand description

Generic object and connection pool. This is the static version of the pool which doesn’t include.

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

A pool of existing objects can be created from an existing collection of objects if it has a known exact size:

use deadpool::unmanaged::Pool;
let pool = Pool::from(vec![1, 2, 3]);

Implementations

Creates a new empty Pool with the given max_size.

Create a new empty Pool using the given PoolConfig.

Retrieves an Object from this Pool or waits for the one to become available.

Errors

See PoolError for details.

Retrieves an Object from this Pool and doesn’t wait if there is currently no Object is available and the maximum Pool size has been reached.

Errors

See PoolError for details.

Retrieves an Object from this Pool using a different timeout than the configured one.

Errors

See PoolError for details.

Adds an object to this Pool.

If the Pool size has already reached its maximum, then this function blocks until the object can be added to the Pool.

Errors

If the Pool has been closed a tuple containing the object and the PoolError is returned instead.

Tries to add an object to this Pool.

Errors

If the Pool size has already reached its maximum, or the Pool has been closed, then a tuple containing the object and the PoolError is returned instead.

Removes an Object from this Pool.

Tries to remove an Object from this Pool.

Removes an Object from this Pool using a different timeout than the configured one.

Closes this Pool.

All current and future tasks waiting for Objects will return PoolError::Closed immediately.

Indicates whether this Pool has been closed.

Retrieves Status of this Pool.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Creates a new Pool from the given ExactSizeIterator of Objects.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.