pub struct TypedBus { /* private fields */ }Expand description
Typed in-Node event bus. Carries published events from one
poll cycle to the next; the engine’s bus-routing pass drains
the queue and routes to subscribed NodeSiteIds.
Bounded by NodeConfig.bus_capacity (default 1024). When a
publish would exceed the cap, the oldest event is FIFO-dropped
and a counter increments. The routing pass reads the counter
and emits InfraEvent::BusOverflow { count } so the host sees
the loss.
Implementations§
Source§impl TypedBus
impl TypedBus
Sourcepub fn with_cap(cap: Option<usize>) -> TypedBus
pub fn with_cap(cap: Option<usize>) -> TypedBus
Construct a fresh empty bus with the given FIFO-drop cap.
Sourcepub fn publish(&mut self, event: NodeEvent)
pub fn publish(&mut self, event: NodeEvent)
Publish an event. The engine’s bus-routing pass delivers published events to subscribed Components in the next poll cycle.
Sourcepub fn drain(&mut self) -> Vec<NodeEvent>
pub fn drain(&mut self) -> Vec<NodeEvent>
Drain all queued events. Called by the engine’s bus-routing pass.
Sourcepub fn take_dropped_count(&mut self) -> usize
pub fn take_dropped_count(&mut self) -> usize
Read + reset the count of FIFO-dropped events since the last call. Returns 0 when no drops occurred.