pub struct Pool<T> { /* private fields */ }
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§
source§impl<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§
source§impl<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,
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more