pub struct EventRouter { /* private fields */ }Expand description
In-process station event router.
Implementations§
Source§impl EventRouter
impl EventRouter
Sourcepub fn new(limits: EventQueueLimits) -> Self
pub fn new(limits: EventQueueLimits) -> Self
Creates an empty event router.
Sourcepub fn register_station(&mut self, station_id: StationId)
pub fn register_station(&mut self, station_id: StationId)
Registers a station target queue.
Sourcepub fn register_stations(&mut self, stations: &StationSet)
pub fn register_stations(&mut self, stations: &StationSet)
Registers all stations in a set.
Sourcepub fn unregister_station(&mut self, station_id: StationId) -> Option<usize>
pub fn unregister_station(&mut self, station_id: StationId) -> Option<usize>
Unregisters a station queue and returns the number of queued events dropped.
Sourcepub fn route(
&mut self,
event: StationEvent,
) -> Result<PushOutcome, EventRouterError>
pub fn route( &mut self, event: StationEvent, ) -> Result<PushOutcome, EventRouterError>
Routes an event to its target station queue.
Sourcepub fn drain_ready(
&mut self,
station_id: StationId,
current_tick: Tick,
) -> Result<Vec<StationEvent>, EventRouterError>
pub fn drain_ready( &mut self, station_id: StationId, current_tick: Tick, ) -> Result<Vec<StationEvent>, EventRouterError>
Drains events whose target_tick is ready for application.
Sourcepub fn drain_ready_into(
&mut self,
station_id: StationId,
current_tick: Tick,
ready: &mut Vec<StationEvent>,
) -> Result<(), EventRouterError>
pub fn drain_ready_into( &mut self, station_id: StationId, current_tick: Tick, ready: &mut Vec<StationEvent>, ) -> Result<(), EventRouterError>
Drains ready events into caller-owned storage while retaining its capacity.
Sourcepub fn queued_len(&self, station_id: StationId) -> Option<usize>
pub fn queued_len(&self, station_id: StationId) -> Option<usize>
Returns queued event count for one station.
Sourcepub const fn stats(&self) -> EventRouterStats
pub const fn stats(&self) -> EventRouterStats
Returns router statistics.
Trait Implementations§
Source§impl Clone for EventRouter
impl Clone for EventRouter
Source§fn clone(&self) -> EventRouter
fn clone(&self) -> EventRouter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EventRouter
impl Debug for EventRouter
Auto Trait Implementations§
impl Freeze for EventRouter
impl RefUnwindSafe for EventRouter
impl Send for EventRouter
impl Sync for EventRouter
impl Unpin for EventRouter
impl UnsafeUnpin for EventRouter
impl UnwindSafe for EventRouter
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