pub struct EventReceiver { /* private fields */ }Expand description
Receiver for events from the event bus.
Implementations§
Source§impl EventReceiver
impl EventReceiver
Sourcepub fn drain_lagged(&mut self) -> u64
pub fn drain_lagged(&mut self) -> u64
Returns and resets the cumulative count of messages lost due to broadcast channel lag since the last call.
Sourcepub async fn recv(&mut self) -> Option<Arc<AstridEvent>>
pub async fn recv(&mut self) -> Option<Arc<AstridEvent>>
Receive the next event.
Returns None if the channel is closed or if events were dropped
due to the receiver being too slow.
Sourcepub fn try_recv(&mut self) -> Option<Arc<AstridEvent>>
pub fn try_recv(&mut self) -> Option<Arc<AstridEvent>>
Try to receive the next event without blocking.
Returns Some(event) if an event is available, or None if no event
is available or the channel is closed.
Auto Trait Implementations§
impl Freeze for EventReceiver
impl RefUnwindSafe for EventReceiver
impl Send for EventReceiver
impl Sync for EventReceiver
impl Unpin for EventReceiver
impl UnsafeUnpin for EventReceiver
impl UnwindSafe for EventReceiver
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