Skip to main content

Hook

Trait Hook 

Source
pub trait Hook: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn fql_pattern(&self) -> &FqlPattern;
    fn hook_point(&self) -> HookPoint;
    fn execute(&self, ctx: HookContext) -> HookAction;

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

A single hook handler.

Hooks are registered with the HookRegistry and invoked at specific lifecycle points. Each hook declares:

  • An FQL pattern (which components it targets)
  • A hook point (when it fires)
  • A priority (execution order within the same point)

§Thread Safety

Hooks must be Send + Sync for concurrent access from multiple channel runners.

Required Methods§

Source

fn id(&self) -> &str

Unique identifier for this hook.

Source

fn fql_pattern(&self) -> &FqlPattern

FQL pattern this hook matches.

Source

fn hook_point(&self) -> HookPoint

Which lifecycle point this hook fires on.

Source

fn execute(&self, ctx: HookContext) -> HookAction

Execute the hook with the given context.

§Returns
  • Continue(ctx) — pass modified context to next hook / operation
  • Skip(value) — skip the operation (pre-hooks only)
  • Abort { reason } — abort the operation (pre-hooks only)
  • Replace(value) — replace result payload (post-hooks only)

Provided Methods§

Source

fn priority(&self) -> i32

Priority (lower = earlier). Default: 100.

Implementors§