#[non_exhaustive]pub struct HookMatcher {
pub matcher: Option<String>,
pub hooks: Vec<Hook>,
pub extra: Extra,
}Expand description
A matcher group: the hooks to run when matcher matches the event.
Docs: matcher patterns.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.matcher: Option<String>What the group matches, case-sensitive. Each event matches on its own
field: the tool name for tool events, the agent type for subagent
events, the source for SessionStart, and so on.
- Values:
"*",""or unset matches everything; a string of only letters, digits,_,-, spaces,,and|is an exact name or a list of names (Edit|Write); anything else is an unanchored JavaScript regular expression (mcp__memory__.*). - Default: unset: every occurrence of the event.
Docs: matcher.
hooks: Vec<Hook>The handlers to run, in parallel, when the group matches.
- Values:
Hooks:command,http,mcp_tool,promptoragent. - Default: none: Claude Code requires the key, so this crate always writes it (an empty list when unset).
Docs: hook handler fields.
extra: ExtraKeys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.
Implementations§
Source§impl HookMatcher
impl HookMatcher
Sourcepub fn all(hooks: impl IntoIterator<Item = Hook>) -> Self
pub fn all(hooks: impl IntoIterator<Item = Hook>) -> Self
A group that runs hooks on every occurrence of the event.
Trait Implementations§
Source§impl Clone for HookMatcher
impl Clone for HookMatcher
Source§impl Debug for HookMatcher
impl Debug for HookMatcher
Source§impl Default for HookMatcher
impl Default for HookMatcher
Source§impl<'de> Deserialize<'de> for HookMatcher
impl<'de> Deserialize<'de> for HookMatcher
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for HookMatcher
impl PartialEq for HookMatcher
Source§impl Serialize for HookMatcher
impl Serialize for HookMatcher
impl StructuralPartialEq for HookMatcher
Auto Trait Implementations§
impl Forget for HookMatcher
impl Freeze for HookMatcher
impl Move for HookMatcher
impl RefUnwindSafe for HookMatcher
impl Send for HookMatcher
impl Sync for HookMatcher
impl Unpin for HookMatcher
impl UnsafeUnpin for HookMatcher
impl UnwindSafe for HookMatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more