pub struct EventStream { /* private fields */ }Expand description
A receiver that surfaces lag as data: when this consumer falls behind the
bounded channel, the next recv yields the count of samples it missed —
dropped samples are never invisible (RFC 05 §3.1’s honesty, applied to a
UI).
Implementations§
Source§impl EventStream
impl EventStream
Sourcepub fn into_stream(self) -> impl Stream<Item = StreamItem> + Send
pub fn into_stream(self) -> impl Stream<Item = StreamItem> + Send
The same items as a Stream (#343).
Consuming rather than borrowing, because the consumer that wanted this
is a UI subscription that must own a 'static stream — a borrowing
adapter could not be handed to one. Take a second EventStream from
Monitor::events if the original is still
needed for a recv loop; each receiver has its own place in the ring.
unfold rather than a hand-written poll_next: a broadcast receiver
has no poll_recv, so a direct impl would have to store the borrowed
recv future beside the receiver it borrows from — a self-referential
struct, and unsafe for nothing. Lag still folds into the monitor’s
dropped counter and still arrives as StreamItem::Dropped, since
this drives the same recv that does both. A generic
broadcast-to-stream adapter would surface lag as an error instead,
which is the one thing this type exists to prevent.
Sourcepub async fn recv(&mut self) -> Option<StreamItem>
pub async fn recv(&mut self) -> Option<StreamItem>
None when the monitor stopped.
Auto Trait Implementations§
impl !RefUnwindSafe for EventStream
impl !UnwindSafe for EventStream
impl Freeze for EventStream
impl Send for EventStream
impl Sync for EventStream
impl Unpin for EventStream
impl UnsafeUnpin for EventStream
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more