Trait ConnectionManager

Source
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§

Source

type Connection: Send

Type of ConnectionManager::Connections that this ConnectionManager creates and recycles.

Source

type Error: Error + Send + Sync + 'static

Error that this ConnectionManager can return when creating and/or recycling ConnectionManager::Connections.

Source

type CreateFut: Future<Output = Result<Self::Connection, Self::Error>> + Send

Future that resolves to a new ConnectionManager::Connection when created.

Source

type ValidFut<'a>: Future<Output = bool> + Send where Self: 'a

Future that resolves to true if the connection is valid, false otherwise.

Required Methods§

Source

fn create_connection(&self) -> Self::CreateFut

Create a new connection.

Source

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.

Implementors§