Type Alias diesel_async::pooled_connection::deadpool::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>> + Send + Sync>),
    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>> + Send + Sync>),
}

Variants§

§

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

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>> + Send + Sync>)

Use an async function as a hook