pub trait HookHandler: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn subscribed(&self) -> &'static [HookEventKind];
fn on_event<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 HookContext,
event: &'life2 mut HookEvent<'life3>,
) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
// Provided method
fn timeout(&self) -> Duration { ... }
}Expand description
A lifecycle hook handler.
Required Methods§
Sourcefn subscribed(&self) -> &'static [HookEventKind]
fn subscribed(&self) -> &'static [HookEventKind]
Events this handler subscribes to.
Sourcefn on_event<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 HookContext,
event: &'life2 mut HookEvent<'life3>,
) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_event<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 HookContext,
event: &'life2 mut HookEvent<'life3>,
) -> Pin<Box<dyn Future<Output = HookResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Handles a runtime event.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".