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>> + Send + Sync>),
    AsyncFn(Box<dyn for<'a> Fn(&'a mut ClientWrapper, &'a Metrics) -> Pin<Box<dyn Future<Output = Result<(), HookError<Error>>> + Send + 'a>> + Send + Sync>),
}

Variants§

§

Fn(Box<dyn Fn(&mut ClientWrapper, &Metrics) -> Result<(), HookError<Error>> + Send + Sync>)

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

Use an async function as a hook