pub struct RuntimeHookRegistry { /* private fields */ }Expand description
Per-agent hook registry.
Implementations§
Source§impl HookRegistry
impl HookRegistry
Sourcepub fn new() -> HookRegistry
pub fn new() -> HookRegistry
Creates an empty registry.
Sourcepub fn register(&mut self, handler: Arc<dyn HookHandler>)
pub fn register(&mut self, handler: Arc<dyn HookHandler>)
Registers a handler for all of its subscribed event kinds.
Sourcepub fn handlers_for(&self, kind: HookEventKind) -> usize
pub fn handlers_for(&self, kind: HookEventKind) -> usize
Returns the number of handlers registered for an event kind.
Sourcepub fn registrations(&self) -> Vec<HookRegistration>
pub fn registrations(&self) -> Vec<HookRegistration>
Returns a read-only diagnostic snapshot of registered handlers.
Sourcepub async fn dispatch<'a>(
&self,
ctx: &HookContext,
event: HookEvent<'a>,
) -> HookOutcome<'a>
pub async fn dispatch<'a>( &self, ctx: &HookContext, event: HookEvent<'a>, ) -> HookOutcome<'a>
Dispatches a hook event sequentially to all subscribed handlers.
Sourcepub async fn dispatch_permission_gate<'a>(
&self,
ctx: &HookContext,
event: HookEvent<'a>,
) -> HookOutcome<'a>
pub async fn dispatch_permission_gate<'a>( &self, ctx: &HookContext, event: HookEvent<'a>, ) -> HookOutcome<'a>
Dispatches the final permission gate with fail-closed failure semantics.
Unlike general lifecycle dispatch, Skip, panic, and timeout deny the operation. Callers
may execute only when this method returns HookOutcome::Continue.
Trait Implementations§
Source§impl Default for HookRegistry
impl Default for HookRegistry
Source§fn default() -> HookRegistry
fn default() -> HookRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for HookRegistry
impl !UnwindSafe for HookRegistry
impl Freeze for HookRegistry
impl Send for HookRegistry
impl Sync for HookRegistry
impl Unpin for HookRegistry
impl UnsafeUnpin for HookRegistry
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