pub struct HookEngine { /* private fields */ }Expand description
Hook engine for managing and executing hooks
Implementations§
Source§impl HookEngine
impl HookEngine
Sourcepub fn with_hooks_dir(hooks_dir: impl Into<PathBuf>) -> Self
pub fn with_hooks_dir(hooks_dir: impl Into<PathBuf>) -> Self
Create a hook engine with a custom hooks directory
Sourcepub fn register_hook(&mut self, hook: AgentHook) -> Result<()>
pub fn register_hook(&mut self, hook: AgentHook) -> Result<()>
Register a hook
Sourcepub fn unregister_hook(&mut self, id: &str) -> Result<AgentHook>
pub fn unregister_hook(&mut self, id: &str) -> Result<AgentHook>
Unregister a hook by ID
Sourcepub fn get_hook_mut(&mut self, id: &str) -> Option<&mut AgentHook>
pub fn get_hook_mut(&mut self, id: &str) -> Option<&mut AgentHook>
Get a mutable reference to a hook by ID
Sourcepub fn list_hooks(&self) -> &[AgentHook]
pub fn list_hooks(&self) -> &[AgentHook]
List all hooks
Sourcepub fn enable_hook(&mut self, id: &str) -> Result<()>
pub fn enable_hook(&mut self, id: &str) -> Result<()>
Enable a hook
Sourcepub fn disable_hook(&mut self, id: &str) -> Result<()>
pub fn disable_hook(&mut self, id: &str) -> Result<()>
Disable a hook
Sourcepub fn find_file_change_hooks(&self, path: &Path) -> Vec<&AgentHook>
pub fn find_file_change_hooks(&self, path: &Path) -> Vec<&AgentHook>
Find hooks that match a file change
Sourcepub fn find_git_op_hooks(&self, op: &GitOp) -> Vec<&AgentHook>
pub fn find_git_op_hooks(&self, op: &GitOp) -> Vec<&AgentHook>
Find hooks that match a git operation
Sourcepub fn find_build_event_hooks(&self, event: &BuildEvent) -> Vec<&AgentHook>
pub fn find_build_event_hooks(&self, event: &BuildEvent) -> Vec<&AgentHook>
Find hooks that match a build event
Sourcepub fn find_test_result_hooks(&self, result: &TestResult) -> Vec<&AgentHook>
pub fn find_test_result_hooks(&self, result: &TestResult) -> Vec<&AgentHook>
Find hooks that match a test result
Sourcepub fn find_manual_hooks(&self, command: &str) -> Vec<&AgentHook>
pub fn find_manual_hooks(&self, command: &str) -> Vec<&AgentHook>
Find hooks that match a manual command
Sourcepub fn trigger_file_change(&self, path: &Path) -> Vec<HookExecutionResult>
pub fn trigger_file_change(&self, path: &Path) -> Vec<HookExecutionResult>
Trigger hooks for a file change event
Sourcepub fn trigger_git_op(&self, op: &GitOp) -> Vec<HookExecutionResult>
pub fn trigger_git_op(&self, op: &GitOp) -> Vec<HookExecutionResult>
Trigger hooks for a git operation
Sourcepub fn trigger_build_event(
&self,
event: &BuildEvent,
) -> Vec<HookExecutionResult>
pub fn trigger_build_event( &self, event: &BuildEvent, ) -> Vec<HookExecutionResult>
Trigger hooks for a build event
Sourcepub fn trigger_test_result(
&self,
result: &TestResult,
) -> Vec<HookExecutionResult>
pub fn trigger_test_result( &self, result: &TestResult, ) -> Vec<HookExecutionResult>
Trigger hooks for a test result
Sourcepub fn trigger_manual(&self, command: &str) -> Vec<HookExecutionResult>
pub fn trigger_manual(&self, command: &str) -> Vec<HookExecutionResult>
Trigger a manual hook
Sourcepub fn load_hooks(&mut self, path: &Path) -> Result<usize>
pub fn load_hooks(&mut self, path: &Path) -> Result<usize>
Load hooks from the hooks directory
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the engine is running
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HookEngine
impl RefUnwindSafe for HookEngine
impl Send for HookEngine
impl Sync for HookEngine
impl Unpin for HookEngine
impl UnsafeUnpin for HookEngine
impl UnwindSafe for HookEngine
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.