pub struct HookRegistry { /* private fields */ }Expand description
Registry that manages and dispatches lifecycle hooks.
Implementations§
Source§impl HookRegistry
impl HookRegistry
Sourcepub fn register(&mut self, hook: impl LifecycleHook + 'static)
pub fn register(&mut self, hook: impl LifecycleHook + 'static)
Register a new hook. Hooks are sorted by priority after insertion.
Sourcepub fn register_arc(&mut self, hook: Arc<dyn LifecycleHook>)
pub fn register_arc(&mut self, hook: Arc<dyn LifecycleHook>)
Register a pre-built Arc hook.
Sourcepub async fn dispatch(&self, event: &LifecycleEvent) -> HookResult
pub async fn dispatch(&self, event: &LifecycleEvent) -> HookResult
Dispatch an event to all matching hooks.
Returns HookResult::Cancel if any hook cancels, otherwise Continue.
Modified results from earlier hooks are passed through.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HookRegistry
impl !RefUnwindSafe for HookRegistry
impl Send for HookRegistry
impl Sync for HookRegistry
impl Unpin for HookRegistry
impl UnsafeUnpin for HookRegistry
impl !UnwindSafe 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