pub struct EventMask(/* private fields */);Expand description
One bit per Hooks event kind — the union gate every dispatch call site
(hook_gate!) checks before doing ANY per-event work: payload
construction, the ≤2KB cap copy, deadline registration, cancel-race
scaffolding. A session whose Hooks impl doesn’t register a given event
pays exactly one branch on a cached u8 for it instead (§S1 HookRouter
diet).
This is the union half of the design doc’s { union: EventMask, per_event: [SmallVec<[HookId;2]>; 6] } table (design-docs §S1). hotl has
exactly one Hooks object per session — there is no multi-hook registry
to index a per-event dispatch table against — so only the union mask and
its gates land here; the per-event table is deliberately left out. A
future multi-hook registry would extend EventMask to that per-event
table; until then, a registered event still runs every matching hook
internally (lane 1 merges in registration order, lane 2 runs matching
shell hooks concurrently) — the mask only decides whether the wrapper
runs at all.
Implementations§
Source§impl EventMask
impl EventMask
pub const PRE_TOOL: EventMask
pub const POST_TOOL: EventMask
pub const USER_PROMPT: EventMask
pub const NOTIFICATION: EventMask
pub const STOP: EventMask
pub const SESSION_END: EventMask
Sourcepub const ALL: EventMask
pub const ALL: EventMask
Every event registered — the trait default, so an impl that hasn’t opted into narrower dispatch (an external/unknown lane) stays correct.
pub const fn contains(self, bit: EventMask) -> bool
pub const fn union(self, other: EventMask) -> EventMask
Sourcepub const fn difference(self, other: EventMask) -> EventMask
pub const fn difference(self, other: EventMask) -> EventMask
Clear other’s bits from self — used to narrow the mask when a
three-strike eviction silences the last live hook for an event.
pub const fn bits(self) -> u8
Trait Implementations§
impl Copy for EventMask
impl Eq for EventMask
impl StructuralPartialEq for EventMask
Auto Trait Implementations§
impl Freeze for EventMask
impl RefUnwindSafe for EventMask
impl Send for EventMask
impl Sync for EventMask
impl Unpin for EventMask
impl UnsafeUnpin for EventMask
impl UnwindSafe for EventMask
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.