pub struct HookEngine { /* private fields */ }Expand description
Hook engine
Implementations§
Source§impl HookEngine
impl HookEngine
Sourcepub fn with_event_channel(self, tx: Sender<HookEvent>) -> Self
pub fn with_event_channel(self, tx: Sender<HookEvent>) -> Self
Set the event sender channel
Sourcepub fn unregister(&self, hook_id: &str) -> Option<Hook>
pub fn unregister(&self, hook_id: &str) -> Option<Hook>
Unregister a hook
Sourcepub fn register_handler(&self, hook_id: &str, handler: Arc<dyn HookHandler>)
pub fn register_handler(&self, hook_id: &str, handler: Arc<dyn HookHandler>)
Register a handler
Sourcepub fn unregister_handler(&self, hook_id: &str)
pub fn unregister_handler(&self, hook_id: &str)
Unregister a handler
Sourcepub fn matching_hooks(&self, event: &HookEvent) -> Vec<Hook>
pub fn matching_hooks(&self, event: &HookEvent) -> Vec<Hook>
Get all hooks matching an event (sorted by priority)
Sourcepub async fn fire(&self, event: &HookEvent) -> HookResult
pub async fn fire(&self, event: &HookEvent) -> HookResult
Fire an event and get the result
Sourcepub fn hook_count(&self) -> usize
pub fn hook_count(&self) -> usize
Get the number of registered hooks
Trait Implementations§
Source§impl Debug for HookEngine
impl Debug for HookEngine
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> 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