Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
HookRegistry
Defined in the hooks module.
Rust AI Agent SDK
Hook registry for managing hooks
Fields
| Name | Type | Description |
|---|
hooks | HashMap<HookEvent | - |
Methods
new
Create a new hook registry
add_hook
fn add_hook(
&mut self,
event: HookEvent,
func: impl Fn(&HookInput) -> HookResult + Send + Sync + 'static,
) -> &mut Self
Add a hook
Parameters:
| Name | Type |
|---|
event | HookEvent |
func | impl Fn(&HookInput |
add_hook_with_matcher
fn add_hook_with_matcher(
&mut self,
event: HookEvent,
matcher: impl Into<String>,
func: impl Fn(&HookInput) -> HookResult + Send + Sync + 'static,
) -> &mut Self
Add a hook with matcher
Parameters:
| Name | Type |
|---|
event | HookEvent |
matcher | impl Into<String> |
func | impl Fn(&HookInput |
add_definition
fn add_definition(&mut self, hook: HookDefinition) -> &mut Self
Add a hook definition
Parameters:
| Name | Type |
|---|
hook | HookDefinition |
remove_hook
fn remove_hook(&mut self, id: &str) -> bool
Remove a hook by ID
Parameters:
has_hooks
fn has_hooks(&self, event: HookEvent) -> bool
Check if any hooks exist for an event
Parameters:
hook_count
fn hook_count(&self, event: HookEvent) -> usize
Get hook count for an event
Parameters:
execute
fn execute(&self, event: HookEvent, input: &HookInput) -> HookResult
Execute all hooks for an event
Parameters:
| Name | Type |
|---|
event | HookEvent |
input | &HookInput |
execute_async
async fn execute_async(&self, event: HookEvent, input: &HookInput) -> HookResult
Execute hooks asynchronously (for future async hooks)
Parameters:
| Name | Type |
|---|
event | HookEvent |
input | &HookInput |
Source
View on GitHub
praisonai/src/hooks/mod.rs at line 359