pub struct ConnectionPool<M: ConnectionManager> { /* private fields */ }Expand description
Connection pool
Implementations§
Source§impl<M> ConnectionPool<M>
impl<M> ConnectionPool<M>
Sourcepub fn new(
max_size: Option<usize>,
max_idle_time: Option<Duration>,
connection_timeout: Option<Duration>,
cleanup_config: Option<CleanupConfig>,
manager: M,
) -> Arc<Self>
pub fn new( max_size: Option<usize>, max_idle_time: Option<Duration>, connection_timeout: Option<Duration>, cleanup_config: Option<CleanupConfig>, manager: M, ) -> Arc<Self>
Create a new connection pool
Sourcepub async fn get_connection(
self: Arc<Self>,
) -> Result<ManagedConnection<M>, PoolError<M::Error>>
pub async fn get_connection( self: Arc<Self>, ) -> Result<ManagedConnection<M>, PoolError<M::Error>>
Get a connection from the pool
pub fn outstanding_count(&self) -> usize
pub async fn pool_size(&self) -> usize
pub fn max_size(&self) -> usize
Sourcepub async fn stop_cleanup_task(&self)
pub async fn stop_cleanup_task(&self)
Stop the background cleanup task
Sourcepub async fn restart_cleanup_task(&self, cleanup_config: CleanupConfig)
pub async fn restart_cleanup_task(&self, cleanup_config: CleanupConfig)
Restart the background cleanup task with new configuration
Source§impl<A> ConnectionPool<TcpConnectionManager<A>>
impl<A> ConnectionPool<TcpConnectionManager<A>>
Auto Trait Implementations§
impl<M> Freeze for ConnectionPool<M>where
M: Freeze,
impl<M> !RefUnwindSafe for ConnectionPool<M>
impl<M> Send for ConnectionPool<M>
impl<M> Sync for ConnectionPool<M>
impl<M> Unpin for ConnectionPool<M>where
M: Unpin,
impl<M> UnsafeUnpin for ConnectionPool<M>where
M: UnsafeUnpin,
impl<M> !UnwindSafe for ConnectionPool<M>
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