pub struct HookRunner { /* private fields */ }Expand description
Manages and executes hooks.
Implementations§
Source§impl HookRunner
impl HookRunner
pub fn new() -> Self
Sourcepub fn load_from_config(&mut self, defs: Vec<HookDef>)
pub fn load_from_config(&mut self, defs: Vec<HookDef>)
Load multiple TOML hook defs from config.
Sourcepub fn register(&mut self, hook: HookDefinition)
pub fn register(&mut self, hook: HookDefinition)
Register a programmatic hook (for Lua or other extensions).
Sourcepub fn set_background_reporter(
&mut self,
reporter: Arc<dyn Fn(HookBackgroundEvent) + Send + Sync>,
)
pub fn set_background_reporter( &mut self, reporter: Arc<dyn Fn(HookBackgroundEvent) + Send + Sync>, )
Register an observer for background non-blocking hook failures.
Sourcepub fn register_callback(
&mut self,
event: &str,
callback: Arc<dyn Fn(&HookEvent<'_>) -> HookResult + Send + Sync>,
)
pub fn register_callback( &mut self, event: &str, callback: Arc<dyn Fn(&HookEvent<'_>) -> HookResult + Send + Sync>, )
Register a callback hook for a specific event.
Sourcepub async fn fire(&self, event: &HookEvent<'_>) -> Vec<HookResult>
pub async fn fire(&self, event: &HookEvent<'_>) -> Vec<HookResult>
Fire a hook event and collect results.
Execution order: TOML hooks first (config order), then programmatic hooks (registration order). Blocking hooks execute sequentially and await completion. Non-blocking hooks are spawned as background tokio tasks.
Trait Implementations§
Auto 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
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 more