[][src]Trait mobc::Manager

pub trait Manager: Send + Sync + 'static {
    type Connection: Send + 'static;
    type Error: Send + Sync + 'static;
    fn connect(&self) -> ResultFuture<Self::Connection, Self::Error>;
fn check(
        &self,
        conn: Self::Connection
    ) -> ResultFuture<Self::Connection, Self::Error>; fn spawn_task<T>(&self, task: T)
    where
        T: Future + Send + 'static,
        T::Output: Send + 'static
, { ... } }

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(&self) -> ResultFuture<Self::Connection, Self::Error>

Attempts to create a new connection.

fn check(
    &self,
    conn: Self::Connection
) -> ResultFuture<Self::Connection, Self::Error>

Determines if the connection is still connected to the database.

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.

Loading content...

Implementors

Loading content...