EventReceiver

Struct EventReceiver 

Source
pub struct EventReceiver { /* private fields */ }
Expand description

Receiver for events from an EventBus

Implementations§

Source§

impl EventReceiver

Source

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 dropped
  • EventReceiveError::Lagged - The receiver fell behind and missed some events
Source

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 now
  • EventTryReceiveError::BusDropped - All event bus senders have been dropped
  • EventTryReceiveError::Lagged - The receiver fell behind and missed some events

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.