Skip to main content

PostExecutionHook

Trait PostExecutionHook 

Source
pub trait PostExecutionHook: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn run(&self, result: &ExecutionResult, project_path: &Path) -> HookResult;

    // Provided methods
    fn run_on_dry_run(&self) -> bool { ... }
    fn run_on_syntax_error(&self) -> bool { ... }
}
Expand description

Trait for post-execution hooks.

Hooks are called after mutation execution completes. They can perform additional validation, external tool invocation, or other side effects.

§Example

use ryo_app::{PostExecutionHook, ExecutionResult, HookResult};
use std::path::Path;

struct CargoCheckHook;

impl PostExecutionHook for CargoCheckHook {
    fn name(&self) -> &str {
        "cargo-check"
    }

    fn run(&self, result: &ExecutionResult, project_path: &Path) -> HookResult {
        // Run cargo check...
        HookResult::Success
    }
}

Required Methods§

Source

fn name(&self) -> &str

Hook name for logging/display.

Source

fn run(&self, result: &ExecutionResult, project_path: &Path) -> HookResult

Run the hook after execution.

§Arguments
  • result - The execution result from Api
  • project_path - Path to the project root
§Returns
  • HookResult indicating success, warning, or error

Provided Methods§

Source

fn run_on_dry_run(&self) -> bool

Whether to run this hook on dry-run executions. Default is false (skip on dry-run).

Source

fn run_on_syntax_error(&self) -> bool

Whether to run this hook when execution had syntax errors. Default is false (skip on syntax errors).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§