Skip to main content

HookCallback

Trait HookCallback 

Source
pub trait HookCallback<I>: Send + Sync
where I: Send + 'static,
{ // Required method fn call<'a>( &'a self, input: I, context: HookContext, ) -> Pin<Box<dyn Future<Output = HookDecision> + Send + 'a>>; }
Expand description

Trait for hook callbacks. Each hook kind has its own concrete callback; the trait is parameterised over the input type.

Required Methods§

Source

fn call<'a>( &'a self, input: I, context: HookContext, ) -> Pin<Box<dyn Future<Output = HookDecision> + Send + 'a>>

Called when the matching hook fires.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F, Fut, I> HookCallback<I> for F
where F: Fn(I, HookContext) -> Fut + Send + Sync, Fut: Future<Output = HookDecision> + Send + 'static, I: Send + 'static,