Skip to main content

PooledConnection

Trait PooledConnection 

Source
pub trait PooledConnection:
    Send
    + Sync
    + 'static {
    // Required methods
    fn is_healthy<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn created_at(&self) -> Instant;
    fn last_activity(&self) -> Instant;
    fn update_activity(&mut self);
    fn clone_connection(&self) -> Box<dyn PooledConnection>;
}
Expand description

Generic connection trait

Required Methods§

Source

fn is_healthy<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if connection is healthy

Source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close the connection

Source

fn created_at(&self) -> Instant

Get connection creation time

Source

fn last_activity(&self) -> Instant

Get last activity time

Source

fn update_activity(&mut self)

Update last activity time

Source

fn clone_connection(&self) -> Box<dyn PooledConnection>

Clone the connection (custom method for trait object compatibility)

Trait Implementations§

Source§

impl PooledConnection for Box<dyn PooledConnection>

Implement PooledConnection for Box<dyn PooledConnection> to enable trait object usage

Source§

fn is_healthy<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if connection is healthy
Source§

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close the connection
Source§

fn created_at(&self) -> Instant

Get connection creation time
Source§

fn last_activity(&self) -> Instant

Get last activity time
Source§

fn update_activity(&mut self)

Update last activity time
Source§

fn clone_connection(&self) -> Box<dyn PooledConnection>

Clone the connection (custom method for trait object compatibility)

Implementations on Foreign Types§

Source§

impl PooledConnection for Box<dyn PooledConnection>

Implement PooledConnection for Box<dyn PooledConnection> to enable trait object usage

Source§

fn is_healthy<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn created_at(&self) -> Instant

Source§

fn last_activity(&self) -> Instant

Source§

fn update_activity(&mut self)

Source§

fn clone_connection(&self) -> Box<dyn PooledConnection>

Implementors§