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
sourceimpl<T> Pool<T>
impl<T> Pool<T>
sourcepub fn from_config(config: &PoolConfig) -> Self
pub fn from_config(config: &PoolConfig) -> Self
Create a new empty Pool
using the given PoolConfig
.
sourcepub fn close(&self)
pub fn close(&self)
Closes this Pool
.
All current and future tasks waiting for Object
s will return
PoolError::Closed
immediately.
Trait Implementations
sourceimpl<T, I> From<I> for Pool<T> where
I: IntoIterator<Item = T>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
impl<T, I> From<I> for Pool<T> where
I: IntoIterator<Item = T>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
sourcefn from(iter: I) -> Self
fn from(iter: I) -> Self
Creates a new Pool
from the given ExactSizeIterator
of
Object
s.
Auto Trait Implementations
impl<T> !RefUnwindSafe for Pool<T>
impl<T> Send for Pool<T> where
T: Send,
impl<T> Sync for Pool<T> where
T: Send,
impl<T> Unpin for Pool<T>
impl<T> !UnwindSafe for Pool<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more