pub struct ConnectionPool<T> { /* private fields */ }Expand description
Generic connection pool for any transport type
Implementations§
Source§impl<T: Send + 'static> ConnectionPool<T>
impl<T: Send + 'static> ConnectionPool<T>
Sourcepub fn new(
factory: Arc<dyn ConnectionFactory<T>>,
config: PoolConfig,
) -> Result<Self>
pub fn new( factory: Arc<dyn ConnectionFactory<T>>, config: PoolConfig, ) -> Result<Self>
Create a new connection pool
Sourcepub async fn acquire(&self) -> Result<PooledConnectionGuard<T>>
pub async fn acquire(&self) -> Result<PooledConnectionGuard<T>>
Get a connection from the pool or create a new one
Sourcepub fn metrics(&self) -> Arc<PoolMetrics>
pub fn metrics(&self) -> Arc<PoolMetrics>
Get pool metrics
Sourcepub fn config(&self) -> &PoolConfig
pub fn config(&self) -> &PoolConfig
Get pool configuration
Auto Trait Implementations§
impl<T> Freeze for ConnectionPool<T>
impl<T> !RefUnwindSafe for ConnectionPool<T>
impl<T> Send for ConnectionPool<T>where
T: Send,
impl<T> Sync for ConnectionPool<T>where
T: Send,
impl<T> Unpin for ConnectionPool<T>
impl<T> UnsafeUnpin for ConnectionPool<T>
impl<T> !UnwindSafe for ConnectionPool<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