Trait bb8::ManageConnection

source ·
pub trait ManageConnection: Sized + Send + Sync + 'static {
    type Connection: Send + 'static;
    type Error: Debug + Send + 'static;

    // Required methods
    fn connect<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Connection, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_valid<'life0, 'life1, 'async_trait>(
        &'life0 self,
        conn: &'life1 mut Self::Connection
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn has_broken(&self, conn: &mut Self::Connection) -> bool;
}
Expand description

A trait which provides connection-specific functionality.

Required Associated Types§

source

type Connection: Send + 'static

The connection type this manager deals with.

source

type Error: Debug + Send + 'static

The error type returned by Connections.

Required Methods§

source

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

Attempts to create a new connection.

source

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

Determines if the connection is still connected to the database.

source

fn has_broken(&self, conn: &mut Self::Connection) -> bool

Synchronously determine if the connection is no longer usable, if possible.

Object Safety§

This trait is not object safe.

Implementors§