pub struct Feed<S: FeedSource> { /* private fields */ }Expand description
One background feed as a control loop uses it.
The select! arm hands the message that woke the loop to Feed::accept,
and the drain that follows walks Feed::next_ready until the feed is
empty, so a burst of updates costs one draw. A closed channel reports None
for ever, which would leave its arm permanently ready; accept retires the
feed instead, and Feed::is_open gates the arm.
Implementations§
Source§impl<S: FeedSource> Feed<S>
impl<S: FeedSource> Feed<S>
pub fn new(source: S) -> Self
pub fn is_open(&self) -> bool
pub fn wait(&mut self) -> impl Future<Output = Option<S::Item>>
Sourcepub fn accept(&mut self, message: Option<S::Item>) -> bool
pub fn accept(&mut self, message: Option<S::Item>) -> bool
Latches the message that won the select and reports whether one arrived. Applying it determines whether the visible state needs a redraw.
Sourcepub fn next_ready(&mut self) -> Option<S::Item>
pub fn next_ready(&mut self) -> Option<S::Item>
The next message for the batch drain: the one that won the select first, then whatever queued behind it.
Auto Trait Implementations§
impl<S> Freeze for Feed<S>
impl<S> RefUnwindSafe for Feed<S>
impl<S> Send for Feed<S>
impl<S> Sync for Feed<S>
impl<S> Unpin for Feed<S>
impl<S> UnsafeUnpin for Feed<S>
impl<S> UnwindSafe for Feed<S>
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
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.