Type Alias deadpool_postgres::Hook
source · pub type Hook = Hook<Manager>;
Expand description
Type alias for using deadpool::managed::Hook
with tokio_postgres
.
Aliased Type§
enum Hook {
Fn(Box<dyn Fn(&mut ClientWrapper, &Metrics) -> Result<(), HookError<Error>> + Sync + Send>),
AsyncFn(Box<dyn for<'a> Fn(&'a mut ClientWrapper, &'a Metrics) -> Pin<Box<dyn Future<Output = Result<(), HookError<Error>>> + Send + 'a>> + Sync + Send>),
}
Variants§
Fn(Box<dyn Fn(&mut ClientWrapper, &Metrics) -> Result<(), HookError<Error>> + Sync + Send>)
Use a plain function (non-async) as a hook
AsyncFn(Box<dyn for<'a> Fn(&'a mut ClientWrapper, &'a Metrics) -> Pin<Box<dyn Future<Output = Result<(), HookError<Error>>> + Send + 'a>> + Sync + Send>)
Use an async function as a hook