[][src]Trait mobc::Manager

pub trait Manager: Send + Sync + 'static {
    type Connection: Send + 'static;
    type Error: Send + Sync + 'static;
    fn connect<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Connection, Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn check<'life0, 'async_trait>(
        &'life0 self,
        conn: Self::Connection
    ) -> Pin<Box<dyn Future<Output = Result<Self::Connection, Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn spawn_task<T>(&self, task: T)
    where
        T: Future + Send + 'static,
        T::Output: Send + 'static
, { ... }
fn test_on_check_in<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _conn: &'life1 mut Self::Connection
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } }

A trait which provides connection-specific functionality.

Associated Types

type Connection: Send + 'static

The connection type this manager deals with.

type Error: Send + Sync + 'static

The error type returned by Connections.

Loading content...

Required methods

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

Attempts to create a new connection.

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

Determines if the connection is still connected to the database when check-out.

A standard implementation would check if a simple query like SELECT 1 succeeds.

Loading content...

Provided methods

fn spawn_task<T>(&self, task: T) where
    T: Future + Send + 'static,
    T::Output: Send + 'static, 

Spawns a new asynchronous task.

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

Determines connection is still valid when check-in.

Loading content...

Implementors

Loading content...