pub struct HookSystem { /* private fields */ }Implementations§
Source§impl HookSystem
impl HookSystem
pub fn new() -> Self
Sourcepub fn register_defaults(&mut self)
pub fn register_defaults(&mut self)
Register built-in default hooks.
Sourcepub fn register(&mut self, handler: HookHandler)
pub fn register(&mut self, handler: HookHandler)
Register a hook handler, maintaining priority sort order.
Sourcepub async fn load_user_hooks(&mut self, config_path: &str)
pub async fn load_user_hooks(&mut self, config_path: &str)
Load user-defined hooks from a JSON config file.
Format:
{ "hooks": [
{ "name": "lint-on-write", "event": "PostFileWrite", "priority": 50,
"command": "cargo clippy", "matcher": "*.rs" }
] }Sourcepub fn fire(
&self,
event: HookEvent,
tool_name: Option<&str>,
input: Option<&Value>,
) -> HookResult
pub fn fire( &self, event: HookEvent, tool_name: Option<&str>, input: Option<&Value>, ) -> HookResult
Fire all handlers for an event, in priority order. If any handler denies, execution stops and the deny result is returned.
pub fn count(&self) -> usize
pub fn list(&self) -> Vec<(&str, HookEvent, i32, bool)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HookSystem
impl RefUnwindSafe for HookSystem
impl Send for HookSystem
impl Sync for HookSystem
impl Unpin for HookSystem
impl UnsafeUnpin for HookSystem
impl UnwindSafe for HookSystem
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