pub struct HookRunner { /* private fields */ }Expand description
Runs registered hooks at a given hook point.
Implementations§
Source§impl HookRunner
impl HookRunner
pub fn new() -> Self
Sourcepub fn register(&mut self, hook: Arc<dyn AgentHook>)
pub fn register(&mut self, hook: Arc<dyn AgentHook>)
Register a hook. Hooks are sorted by priority (lower runs first).
Sourcepub async fn run_hooks(
&self,
point: AgentHookPoint,
session: &Session,
runtime_state: &mut AgentRuntimeState,
) -> HookResult
pub async fn run_hooks( &self, point: AgentHookPoint, session: &Session, runtime_state: &mut AgentRuntimeState, ) -> HookResult
Run all hooks matching the given point.
Records checkpoints in runtime_state. Returns the first
Suspend or Abort result, or the aggregate result otherwise.
Sourcepub fn has_hooks_for(&self, point: AgentHookPoint) -> bool
pub fn has_hooks_for(&self, point: AgentHookPoint) -> bool
Check if any hooks are registered for the given point.
Trait Implementations§
Source§impl Clone for HookRunner
impl Clone for HookRunner
Source§fn clone(&self) -> HookRunner
fn clone(&self) -> HookRunner
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 moreAuto Trait Implementations§
impl Freeze for HookRunner
impl !RefUnwindSafe for HookRunner
impl Send for HookRunner
impl Sync for HookRunner
impl Unpin for HookRunner
impl UnsafeUnpin for HookRunner
impl !UnwindSafe for HookRunner
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