pub struct LagAwareReceiver { /* private fields */ }Expand description
A broadcast receiver that logs warnings when messages are dropped due to lagging instead of silently losing them.
Obtained via MessageBus::subscribe_lag_aware.
Implementations§
Source§impl LagAwareReceiver
impl LagAwareReceiver
Sourcepub async fn recv(&mut self) -> Option<InterAgentMessage>
pub async fn recv(&mut self) -> Option<InterAgentMessage>
Receive the next message.
If the receiver has fallen behind and messages were skipped, a warning is logged and the next available message is returned.
Returns None if all senders have been dropped (channel closed).
Sourcepub fn try_recv(&mut self) -> Result<InterAgentMessage, TryRecvError>
pub fn try_recv(&mut self) -> Result<InterAgentMessage, TryRecvError>
Try to receive a message without waiting.
Returns the message if available, or an indication of why no message is available.
Sourcepub fn total_skipped(&self) -> u64
pub fn total_skipped(&self) -> u64
Returns the total number of messages skipped due to lagging since this receiver was created.
Auto Trait Implementations§
impl !Freeze for LagAwareReceiver
impl !RefUnwindSafe for LagAwareReceiver
impl !UnwindSafe for LagAwareReceiver
impl Send for LagAwareReceiver
impl Sync for LagAwareReceiver
impl Unpin for LagAwareReceiver
impl UnsafeUnpin for LagAwareReceiver
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