Skip to main content

HookHandler

Trait HookHandler 

Source
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§

Source

fn name(&self) -> &str

Stable handler name used in logs and tests.

Source

fn subscribed(&self) -> &'static [HookEventKind]

Events this handler subscribes to.

Source

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§

Source

fn timeout(&self) -> Duration

Maximum time the framework will wait for on_event.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§