Skip to main content

Hookable

Trait Hookable 

Source
pub trait Hookable {
    // Required method
    fn hook_executor(&self) -> Option<&HookExecutor>;
}
Expand description

Capability to run bidirectional hooks that can block actions.

Hooks differ from observers (Observable) in that they return HookAction to control whether an action proceeds. The executor stops at the first hook that returns a blocking result.

§Implementors

  • LoopManagers — the framework’s default implementation.

§When to use

Use this trait bound when you need to run hooks before or after tool dispatch, compaction, or run start/end.

Required Methods§

Source

fn hook_executor(&self) -> Option<&HookExecutor>

Returns the hook executor, if hooks are configured.

Returns None when no hook executor is set — no pre/post hooks will fire. Hooks can approve or reject actions, unlike observers.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Hookable for LoopManagers

Available on crate feature hooks only.