Skip to main content

AsPool

Trait AsPool 

Source
pub trait AsPool {
    // Required method
    fn with_conn<'a, R, F>(
        &'a self,
        f: F,
    ) -> impl Future<Output = Result<R>> + Send + 'a
       where F: FnOnce(&'a mut Connection) -> BoxFuture<'a, Result<R>> + Send + 'a,
             R: Send + 'a;
}
Expand description

Types from which a Connection can be borrowed for the duration of one closure. The blanket impl GenericClient for &P builds on this.

Implemented on Pool and re-implementable by user wrappers (e.g. a load-balanced multi-pool router).

Required Methods§

Source

fn with_conn<'a, R, F>( &'a self, f: F, ) -> impl Future<Output = Result<R>> + Send + 'a
where F: FnOnce(&'a mut Connection) -> BoxFuture<'a, Result<R>> + Send + 'a, R: Send + 'a,

Acquire a connection, run f on it, release on drop.

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§