Module registry

Module registry 

Source
Expand description

Hook registry for storing and managing hooks

The hook registry is responsible for storing, retrieving, and managing hooks. It provides a central place to register hooks that will be triggered on specific events.

§Examples

use ricecoder_hooks::registry::InMemoryHookRegistry;
use ricecoder_hooks::types::Hook;
use ricecoder_hooks::HookRegistry;

let mut registry = InMemoryHookRegistry::new();

// Register a hook
let hook = Hook {
    id: "hook-1".to_string(),
    name: "Format on save".to_string(),
    event: "file_modified".to_string(),
    enabled: true,
    // ... other fields
};

let hook_id = registry.register_hook(hook)?;
println!("Registered hook: {}", hook_id);

// List all hooks
let hooks = registry.list_hooks()?;
println!("Total hooks: {}", hooks.len());

// List hooks for a specific event
let file_hooks = registry.list_hooks_for_event("file_modified")?;
println!("Hooks for file_modified: {}", file_hooks.len());

// Enable/disable a hook
registry.disable_hook(&hook_id)?;
registry.enable_hook(&hook_id)?;

Re-exports§

pub use storage::InMemoryHookRegistry;

Modules§

storage
In-memory hook storage implementation

Traits§

HookRegistry
Trait for managing hooks