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>> + Sync + Send, Global>),
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, Global>> + Sync + Send, Global>),
}
Variants§
Fn(Box<dyn Fn(&mut <AsyncDieselConnectionManager<C> as Manager>::Type, &Metrics) -> Result<(), HookError<<AsyncDieselConnectionManager<C> as Manager>::Error>> + Sync + Send, Global>)
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, Global>> + Sync + Send, Global>)
Use an async function as a hook