Trait DatabasePool

Source
pub trait DatabasePool:
    Send
    + Sync
    + Clone {
    type Connection: Connection;

    // Required methods
    fn acquire<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Connection>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn release<'life0, 'async_trait>(
        &'life0 self,
        conn: Self::Connection,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A trait for database pools that can be used to acquire and release connections

Required Associated Types§

Source

type Connection: Connection

The type of connection this pool provides

Required Methods§

Source

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

Acquire a connection from the pool

Source

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

Release a connection back to the pool

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§