pub trait ConnectionPool: Send + Sync {
// Required methods
fn get_session<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 str,
) -> Pin<Box<dyn Future<Output = DbResult<Session>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn status(&self) -> PoolStatus;
fn config(&self) -> &DbConfig;
}Expand description
连接池抽象 trait
定义连接池的通用接口,便于测试和替换实现
Required Methods§
Sourcefn get_session<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 str,
) -> Pin<Box<dyn Future<Output = DbResult<Session>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_session<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 str,
) -> Pin<Box<dyn Future<Output = DbResult<Session>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn status(&self) -> PoolStatus
fn status(&self) -> PoolStatus
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".