pub struct Pool<C: ConnectionManager>(/* private fields */);Implementations§
Source§impl<C> Pool<C>
impl<C> Pool<C>
Sourcepub async fn new(config: Config<C>) -> Self
pub async fn new(config: Config<C>) -> Self
Creates a new pool and fills it to the minimum idle size.
Sourcepub async fn get_connection(&self) -> Result<PoolConnection<C>, C::Error>
pub async fn get_connection(&self) -> Result<PoolConnection<C>, C::Error>
Get a connection from the pool or create a new one. If the pool is at capacity this will wait until a connection is available.
Sourcepub async fn try_get_connection(&self) -> Result<PoolConnection<C>, C::Error>
pub async fn try_get_connection(&self) -> Result<PoolConnection<C>, C::Error>
Attempt to get a connection from the pool or create a new one. If the pool is at capacity this will return an error without waiting.
Sourcepub async fn get_connection_timeout(
&self,
timeout: Duration,
) -> Result<PoolConnection<C>, C::Error>
pub async fn get_connection_timeout( &self, timeout: Duration, ) -> Result<PoolConnection<C>, C::Error>
Attempt to get a connection from the pool or create a new one, waiting up to timeout
before returning an error if the pool is at capacity.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Pool<C>
impl<C> !RefUnwindSafe for Pool<C>
impl<C> Send for Pool<C>
impl<C> Sync for Pool<C>
impl<C> Unpin for Pool<C>
impl<C> !UnwindSafe for Pool<C>
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