pub struct HookBus { /* private fields */ }Expand description
Ordered list of hooks; fires events through every match.
Implementations§
Source§impl HookBus
impl HookBus
pub fn new() -> Self
Sourcepub fn with_macro_hooks(self) -> Self
pub fn with_macro_hooks(self) -> Self
Pull in every #[hook]-registered hook.
Sourcepub fn with_macro_hooks_take(self) -> Self
pub fn with_macro_hooks_take(self) -> Self
Consume + return (used by AgentLoop::with_macro_hooks).
pub fn register(&mut self, h: Arc<dyn Hook>)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn fire(&self, ev: &Event<'_>, world: &mut World) -> HookOutcome
pub fn fire(&self, ev: &Event<'_>, world: &mut World) -> HookOutcome
Fire ev through all matching hooks in registration order.
Aggregation:
- First
Denyshort-circuits, return theDeny. - All
Injectpayloads concatenate; if any present and no Deny, returnInject(joined). - Otherwise
Allow.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HookBus
impl !UnwindSafe for HookBus
impl Forget for HookBus
impl Freeze for HookBus
impl Send for HookBus
impl Sync for HookBus
impl Unpin for HookBus
impl UnsafeUnpin for HookBus
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