Trait l337::ManageConnection[][src]

pub trait ManageConnection: Send + Sync + 'static {
    type Connection: Send + 'static;
    type Error: Fail;
    #[must_use]
    fn connect<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Connection, L337Error<Self::Error>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn is_valid<'life0, 'life1, 'async_trait>(
        &'life0 self,
        conn: &'life1 mut Self::Connection
    ) -> Pin<Box<dyn Future<Output = Result<(), L337Error<Self::Error>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn has_broken(&self, conn: &mut Self::Connection) -> bool;
fn timed_out(&self) -> L337Error<Self::Error>; }
Expand description

A trait which provides connection-specific functionality.

Associated Types

type Connection: Send + 'static[src]

The connection type this manager deals with.

type Error: Fail[src]

The error type returned by Connections.

Required methods

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

Attempts to create a new connection.

Note that boxing is used here since impl Trait is not yet supported within trait definitions.

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

Determines if the connection is still connected to the database.

Note that boxing is used here since impl Trait is not yet supported within trait definitions.

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

Quick check to determine if the connection has broken

fn timed_out(&self) -> L337Error<Self::Error>[src]

Produce an error representing a connection timeout.

Implementors