pub trait ActionHook: Send {
// Required methods
fn before_action(&mut self, event: &BeforeActionEvent);
fn after_action(&mut self, event: &AfterActionEvent);
// Provided method
fn name(&self) -> &str { ... }
}Expand description
Hook interface for action execution events
Implement this trait to receive notifications about action execution. Hooks are called in registration order.
§Thread Safety
Hooks must be Send to support multi-threaded execution contexts.
If your hook needs to share state, use Arc<Mutex<T>> or channels.
Required Methods§
Sourcefn before_action(&mut self, event: &BeforeActionEvent)
fn before_action(&mut self, event: &BeforeActionEvent)
Called before action execution
This hook is called before the action logic runs. Use this to:
- Log action invocations
- Prepare state for recording
- Update UI state (mark button as active)
Note: This hook cannot cancel action execution.
Sourcefn after_action(&mut self, event: &AfterActionEvent)
fn after_action(&mut self, event: &AfterActionEvent)
Called after action execution
This hook is called after the action completes (success or failure). Use this to:
- Record action events
- Update analytics
- Send network sync messages
- Update undo/redo buffers
The result field indicates whether execution succeeded.