deadpool_sqlite

Type Alias Hook

Source
pub type Hook = Hook<Manager>;
Expand description

Type alias for using deadpool::managed::Hook with rusqlite.

Aliased Type§

enum Hook {
    Fn(Box<dyn Fn(&mut SyncWrapper<Connection>, &Metrics) -> Result<(), HookError<Error>> + Send + Sync>),
    AsyncFn(Box<dyn for<'a> Fn(&'a mut SyncWrapper<Connection>, &'a Metrics) -> Pin<Box<dyn Future<Output = Result<(), HookError<Error>>> + Send + 'a>> + Send + Sync>),
}

Variants§

§

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

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

§

AsyncFn(Box<dyn for<'a> Fn(&'a mut SyncWrapper<Connection>, &'a Metrics) -> Pin<Box<dyn Future<Output = Result<(), HookError<Error>>> + Send + 'a>> + Send + Sync>)

Use an async function as a hook

Implementations

Source§

impl<M> Hook<M>
where M: Manager,

Source

pub fn sync_fn( f: impl Fn(&mut <M as Manager>::Type, &Metrics) -> Result<(), HookError<<M as Manager>::Error>> + Sync + Send + 'static, ) -> Hook<M>

Create Hook from sync function

Source

pub fn async_fn( f: impl for<'a> Fn(&'a mut <M as Manager>::Type, &'a Metrics) -> Pin<Box<dyn Future<Output = Result<(), HookError<<M as Manager>::Error>>> + Send + 'a>> + Sync + Send + 'static, ) -> Hook<M>

Create Hook from async function

Trait Implementations

Source§

impl<M> Debug for Hook<M>
where M: Manager,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more