pub struct HookMatcher {
pub matcher: Option<String>,
pub hooks: Vec<HookCommand>,
/* private fields */
}Expand description
A matcher that filters when hooks fire, with associated commands.
If matcher is None, the hooks fire for every occurrence of the event.
If matcher is Some(pattern), it is compiled as a regex and tested
against the match value (e.g., tool name).
Fields§
§matcher: Option<String>Optional regex pattern to filter events (e.g., tool name pattern).
hooks: Vec<HookCommand>Commands to execute when the matcher matches.
Implementations§
Source§impl HookMatcher
impl HookMatcher
Sourcepub fn catch_all(hooks: Vec<HookCommand>) -> Self
pub fn catch_all(hooks: Vec<HookCommand>) -> Self
Create a matcher that matches everything.
Sourcepub fn with_pattern(pattern: impl Into<String>, hooks: Vec<HookCommand>) -> Self
pub fn with_pattern(pattern: impl Into<String>, hooks: Vec<HookCommand>) -> Self
Create a matcher with a regex pattern.
Trait Implementations§
Source§impl Clone for HookMatcher
impl Clone for HookMatcher
Source§fn clone(&self) -> HookMatcher
fn clone(&self) -> HookMatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HookMatcher
impl Debug 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
Auto Trait Implementations§
impl Freeze 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