pub struct ConnectionPool { /* private fields */ }Expand description
Wrapper around the lock-free connection pool.
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
pub async fn new(connection_string: &str, config: PoolConfig) -> Result<Self>
Sourcepub async fn acquire(&self) -> MCPResult<PooledConnection<Client>>
pub async fn acquire(&self) -> MCPResult<PooledConnection<Client>>
Acquire a connection from the pool.
Returns a PooledConnection<Client> which implements Deref<Target = Client>
and automatically returns to the pool when dropped.
Sourcepub fn release(&self, _conn: PooledConnection<Client>)
pub fn release(&self, _conn: PooledConnection<Client>)
Release a connection back to the pool.
With PooledConnection, this is automatic on Drop. This method
exists for backward compatibility with existing callers.
pub fn active_count(&self) -> u32
pub const fn max_size(&self) -> u32
pub fn is_closed(&self) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for ConnectionPool
impl !UnwindSafe for ConnectionPool
impl Freeze for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl UnsafeUnpin for ConnectionPool
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