pub trait ConnectionManager:
Sync
+ Send
+ Clone {
type Connection: Send;
type Error: Error + Send + Sync + 'static;
type CreateFut: Future<Output = Result<Self::Connection, Self::Error>> + Send;
type ValidFut<'a>: Future<Output = bool> + Send
where Self: 'a;
// Required methods
fn create_connection(&self) -> Self::CreateFut;
fn is_valid<'a>(
&'a self,
connection: &'a mut Self::Connection,
) -> Self::ValidFut<'a>;
}Expand description
Manager responsible for creating new ConnectionManager::Connections or checking existing ones.
Required Associated Types§
Sourcetype Connection: Send
type Connection: Send
Type of ConnectionManager::Connections that this ConnectionManager creates and recycles.
Sourcetype Error: Error + Send + Sync + 'static
type Error: Error + Send + Sync + 'static
Error that this ConnectionManager can return when creating and/or recycling ConnectionManager::Connections.
Sourcetype CreateFut: Future<Output = Result<Self::Connection, Self::Error>> + Send
type CreateFut: Future<Output = Result<Self::Connection, Self::Error>> + Send
Future that resolves to a new ConnectionManager::Connection when created.
Required Methods§
Sourcefn create_connection(&self) -> Self::CreateFut
fn create_connection(&self) -> Self::CreateFut
Create a new connection.
Sourcefn is_valid<'a>(
&'a self,
connection: &'a mut Self::Connection,
) -> Self::ValidFut<'a>
fn is_valid<'a>( &'a self, connection: &'a mut Self::Connection, ) -> Self::ValidFut<'a>
Check if a connection is valid.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.