Skip to main content

SpawnHook

Trait SpawnHook 

Source
pub trait SpawnHook: Send + Sync {
    // Required methods
    fn before<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Ctx,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn after<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Ctx,
        result: &'life2 Value,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Pre-/post-spawn observation and gating hook fired by MainAIMiddleware (only when OperatorKind is MainAi / Composite).

Required Methods§

Source

fn before<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 Ctx, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook fired before the spawn. Returning Err aborts the spawn.

Source

fn after<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Ctx, result: &'life2 Value, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Hook fired after the spawn (once the worker has finished).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§