Add Hook With Matcher • Rust AI Agent SDK
add_hook_with_matcher: Add a hook with matcher
add_hook_with_matcher
Method
</div>
This is a method of the HookRegistry class in the hooks module.
Add a hook with matcher
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%
graph TD
event["Event Trigger"] --> hook["Hook: add_hook_with_matcher"]
hook --> decision{"Decision"}
decision -- "Allow" --> proc["Process"]
decision -- "Deny" --> block["Block"]
style hook fill:#189AB4,color:#fff
style event fill:#8B0000,color:#fff
style proc fill:#8B0000,color:#fff
style block fill:#8B0000,color:#fffSignature
def add_hook_with_matcher(
&mut self,
event: HookEvent,
matcher: impl Into<String>,
func: impl Fn(&HookInput) -> HookResult + Send + Sync + 'static,
) -> &mut SelfParameters
ParamField
HookEventNo description available.
ParamField
impl Into<String>No description available.
ParamField
impl Fn(&HookInputNo description available.
Returns
ResponseField
&mut Self”> The result of the operation.