diesel_async::pooled_connection::deadpool

Type Alias Hook

source
pub type Hook<C> = Hook<AsyncDieselConnectionManager<C>>;
Expand description

Type alias for using deadpool::managed::Hook with [diesel-async]

Aliased Type§

enum Hook<C> {
    Fn(Box<dyn Fn(&mut <AsyncDieselConnectionManager<C> as Manager>::Type, &Metrics) -> Result<(), HookError<<AsyncDieselConnectionManager<C> as Manager>::Error>> + Sync + Send>),
    AsyncFn(Box<dyn for<'a> Fn(&'a mut <AsyncDieselConnectionManager<C> as Manager>::Type, &'a Metrics) -> Pin<Box<dyn Future<Output = Result<(), HookError<<AsyncDieselConnectionManager<C> as Manager>::Error>>> + Send + 'a>> + Sync + Send>),
}

Variants§

§

Fn(Box<dyn Fn(&mut <AsyncDieselConnectionManager<C> as Manager>::Type, &Metrics) -> Result<(), HookError<<AsyncDieselConnectionManager<C> as Manager>::Error>> + Sync + Send>)

Use a plain function (non-async) as a hook

§

AsyncFn(Box<dyn for<'a> Fn(&'a mut <AsyncDieselConnectionManager<C> as Manager>::Type, &'a Metrics) -> Pin<Box<dyn Future<Output = Result<(), HookError<<AsyncDieselConnectionManager<C> as Manager>::Error>>> + Send + 'a>> + Sync + Send>)

Use an async function as a hook