Skip to main content

TriggerHandler

Trait TriggerHandler 

Source
pub trait TriggerHandler<Ctx, Evt>: Send + Sync {
    // Required methods
    fn events(&self) -> Vec<Evt>;
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Ctx,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn priority(&self) -> i32 { ... }
    fn continue_on_error(&self) -> bool { ... }
}
๐Ÿ‘ŽDeprecated since 3.15.0:

nothing calls it; hook triggers run through backbone_core::write_hooks (the generated <Model>WriteHooks and <Model>Triggers)

Expand description

Generic lifecycle trigger handler.

  • Ctx โ€” entity-specific trigger context (e.g. TriggerContext<Order>)
  • Evt โ€” trigger event type (e.g. TriggerEvent)

Required Methodsยง

Source

fn events(&self) -> Vec<Evt>

๐Ÿ‘ŽDeprecated since 3.15.0:

nothing calls it; hook triggers run through backbone_core::write_hooks (the generated <Model>WriteHooks and <Model>Triggers)

Events this handler responds to.

Source

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

๐Ÿ‘ŽDeprecated since 3.15.0:

nothing calls it; hook triggers run through backbone_core::write_hooks (the generated <Model>WriteHooks and <Model>Triggers)

Handle the trigger event.

Provided Methodsยง

Source

fn priority(&self) -> i32

๐Ÿ‘ŽDeprecated since 3.15.0:

nothing calls it; hook triggers run through backbone_core::write_hooks (the generated <Model>WriteHooks and <Model>Triggers)

Execution priority โ€” lower values run first. Default: 0.

Source

fn continue_on_error(&self) -> bool

๐Ÿ‘ŽDeprecated since 3.15.0:

nothing calls it; hook triggers run through backbone_core::write_hooks (the generated <Model>WriteHooks and <Model>Triggers)

Whether to keep dispatching after this handler errors. Default: false.

Dyn Compatibilityยง

This trait is dyn compatible.

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

Implementorsยง