pub struct PooledConnection { /* private fields */ }Expand description
A connection checked out of a Pool.
Dereferences to Connection. When dropped, the connection is returned to
the pool rather than closed — but only once any RowStream taken from it
has also been dropped, so the connection is never handed out twice while a
query is still streaming.
Implementations§
Source§impl PooledConnection
impl PooledConnection
Sourcepub async fn begin(self) -> Result<Transaction, Error>
pub async fn begin(self) -> Result<Transaction, Error>
Starts a transaction on this connection.
Methods from Deref<Target = Connection>§
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns true if the connection has been closed or hit an I/O error.
Sourcepub fn notifications(&self) -> Receiver<Notification>
pub fn notifications(&self) -> Receiver<Notification>
Subscribes to LISTEN / NOTIFY notifications.
The returned receiver yields notifications delivered on this connection
(after LISTEN). Multiple subscribers are supported.
Sourcepub fn cancel_token(&self) -> CancelToken
pub fn cancel_token(&self) -> CancelToken
Returns a token that can cancel the currently running query.
Trait Implementations§
Source§impl Deref for PooledConnection
impl Deref for PooledConnection
Source§type Target = Connection
type Target = Connection
The resulting type after dereferencing.
Source§fn deref(&self) -> &Connection
fn deref(&self) -> &Connection
Dereferences the value.
Source§impl Drop for PooledConnection
impl Drop for PooledConnection
Source§impl ScriptExecutor for PooledConnection
impl ScriptExecutor for PooledConnection
Auto Trait Implementations§
impl !RefUnwindSafe for PooledConnection
impl !UnwindSafe for PooledConnection
impl Freeze for PooledConnection
impl Send for PooledConnection
impl Sync for PooledConnection
impl Unpin for PooledConnection
impl UnsafeUnpin for PooledConnection
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