pub trait Hook: Send + Sync {
// Required methods
fn events(&self) -> &[HookEvent];
fn on_event<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 HookContext,
) -> Pin<Box<dyn Future<Output = HookAction> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn name(&self) -> &str { ... }
}Required Methods§
Sourcefn on_event<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 HookContext,
) -> Pin<Box<dyn Future<Output = HookAction> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_event<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 HookContext,
) -> Pin<Box<dyn Future<Output = HookAction> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a matching event fires. Returns an action to control flow.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".