pub struct PooledConnection<T: Send + 'static> { /* private fields */ }Expand description
A connection checked out from the pool.
Automatically returned to the pool when dropped. Implements Deref
so you can use it as a reference to the underlying connection type.
§Lock-free guarantee
Drop performs exactly one lock-free ArrayQueue::push (CAS loop)
and one Notify::notify_one() (atomic store + optional futex_wake).
No mutexes, no allocations.
Implementations§
Source§impl<T: Send + 'static> PooledConnection<T>
impl<T: Send + 'static> PooledConnection<T>
Sourcepub fn take(self) -> T
pub fn take(self) -> T
Take the inner value out of the connection, permanently removing it from the pool. The pool’s size is decremented.
Sourcepub fn pool_status(&self) -> PoolStatus
pub fn pool_status(&self) -> PoolStatus
Return a reference to the pool status
Trait Implementations§
Source§impl<T: Send + 'static> AsRef<T> for PooledConnection<T>
impl<T: Send + 'static> AsRef<T> for PooledConnection<T>
Source§impl<T: Send + 'static> Debug for PooledConnection<T>
impl<T: Send + 'static> Debug for PooledConnection<T>
Source§impl<T: Send + 'static> Deref for PooledConnection<T>
impl<T: Send + 'static> Deref for PooledConnection<T>
Source§impl<T: Send + 'static> Drop for PooledConnection<T>
impl<T: Send + 'static> Drop for PooledConnection<T>
impl<T: Send + 'static> Send for PooledConnection<T>
impl<T: Send + 'static> Sync for PooledConnection<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for PooledConnection<T>
impl<T> !UnwindSafe for PooledConnection<T>
impl<T> Freeze for PooledConnection<T>where
T: Freeze,
impl<T> Unpin for PooledConnection<T>where
T: Unpin,
impl<T> UnsafeUnpin for PooledConnection<T>where
T: UnsafeUnpin,
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