Skip to main content

Hook

Trait Hook 

Source
pub trait Hook: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 mut HookContext,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn priority(&self) -> i32 { ... }
}
Expand description

钩子 trait

Required Methods§

Source

fn name(&self) -> &str

获取钩子名称

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 mut HookContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

执行钩子

Provided Methods§

Source

fn priority(&self) -> i32

获取优先级(数字越小优先级越高)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§