pub struct PooledConnection { /* private fields */ }Expand description
连接池中的连接条目,记录创建时间和最后使用时间
created_at:连接的原始创建时间,不随 acquire/release 重置, 用于max_lifetime过期判定。last_used_at:上次归还到池的时间,用于idle_timeout空闲超时判定。
Implementations§
Source§impl PooledConnection
impl PooledConnection
Sourcepub fn created_at(&self) -> Instant
pub fn created_at(&self) -> Instant
连接的原始创建时间(不随 acquire/release 重置)
Sourcepub fn into_inner(self) -> Box<dyn Connection>
pub fn into_inner(self) -> Box<dyn Connection>
提取内部连接(消费 PooledConnection)
用于将连接传递给 Transaction::new 等消费连接的 API。
调用此方法后,连接不再属于池,调用方需自行管理其生命周期。
Trait Implementations§
Source§impl Deref for PooledConnection
impl Deref 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