pub struct EventStream<E: Event> { /* private fields */ }Expand description
A subscription to one event type.
Implementations§
Source§impl<E: Event> EventStream<E>
impl<E: Event> EventStream<E>
Sourcepub async fn recv(&mut self) -> Result<E, RecvError>
pub async fn recv(&mut self) -> Result<E, RecvError>
Wait for the next event.
Returns RecvError::Lagged when this subscriber fell too far behind; the
stream stays usable and resumes at the oldest retained event.
Sourcepub fn try_recv(&mut self) -> Result<E, TryRecvError>
pub fn try_recv(&mut self) -> Result<E, TryRecvError>
Take an event only if one is already waiting.
Used to drain a backlog without awaiting, and in tests to assert that nothing was published.
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for EventStream<E>
impl<E> RefUnwindSafe for EventStream<E>where
Receiver<E>: RefUnwindSafe,
impl<E> Send for EventStream<E>
impl<E> Sync for EventStream<E>
impl<E> Unpin for EventStream<E>
impl<E> UnsafeUnpin for EventStream<E>where
Receiver<E>: UnsafeUnpin,
impl<E> UnwindSafe for EventStream<E>where
Receiver<E>: UnwindSafe,
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