pub struct EventReceiver { /* private fields */ }Expand description
Receiver for events from an EventBus
Implementations§
Source§impl EventReceiver
impl EventReceiver
Sourcepub async fn next(&mut self) -> EventReceiveResult<Event>
pub async fn next(&mut self) -> EventReceiveResult<Event>
Wait for the next event (async blocking)
Returns Ok(Event) when an event is received, or Err(EventReceiveError) if
the EventBus is dropped or the receiver has lagged behind.
§Errors
EventReceiveError::BusDropped- All event bus senders have been droppedEventReceiveError::Lagged- The receiver fell behind and missed some events
Sourcepub fn try_next(&mut self) -> EventTryReceiveResult<Event>
pub fn try_next(&mut self) -> EventTryReceiveResult<Event>
Try to receive an event without blocking
Returns Ok(Event) if an event is immediately available.
§Errors
EventTryReceiveError::Empty- No events available right nowEventTryReceiveError::BusDropped- All event bus senders have been droppedEventTryReceiveError::Lagged- The receiver fell behind and missed some events