[−][src]Struct deadpool::managed::Pool
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
impl<T, E> Pool<T, E>
[src]
pub fn new(
manager: impl Manager<T, E> + Send + Sync + 'static,
max_size: usize
) -> Pool<T, E>
[src]
manager: impl Manager<T, E> + Send + Sync + 'static,
max_size: usize
) -> Pool<T, E>
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.
pub fn from_config(
manager: impl Manager<T, E> + Send + Sync + 'static,
config: PoolConfig
) -> Pool<T, E>
[src]
manager: impl Manager<T, E> + Send + Sync + 'static,
config: PoolConfig
) -> Pool<T, E>
Create new connection pool with a given manager
and config
.
The manager
is used to create and recycle objects and max_size
is the maximum number of objects ever created.
pub async fn get<'_>(&'_ self) -> Result<Object<T, E>, PoolError<E>>
[src]
Retrieve object from pool or wait for one to become available.
pub async fn try_get<'_>(&'_ self) -> Result<Object<T, E>, PoolError<E>>
[src]
Retrieve object from the pool and do not wait if there is currently no object available and the maximum pool size has been reached.
pub async fn timeout_get<'_, '_>(
&'_ self,
timeouts: &'_ Timeouts
) -> Result<Object<T, E>, PoolError<E>>
[src]
&'_ self,
timeouts: &'_ Timeouts
) -> Result<Object<T, E>, PoolError<E>>
Retrieve object using a different timeout config than the one configured.
pub fn status(&self) -> Status
[src]
Retrieve status of the pool
Trait Implementations
Auto Trait Implementations
impl<T, E> !RefUnwindSafe for Pool<T, E>
impl<T, E> Send for Pool<T, E> where
T: Send,
T: Send,
impl<T, E> Sync for Pool<T, E> where
T: Send,
T: Send,
impl<T, E> Unpin for Pool<T, E>
impl<T, E> !UnwindSafe for Pool<T, E>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,