pub struct Filter<W, T>{ /* private fields */ }
Expand description
Wraps a Watcher
to allow observing a derived value.
See Watcher::map
.
Trait Implementations§
Source§impl<W, T> Watcher for Filter<W, T>
impl<W, T> Watcher for Filter<W, T>
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Source§fn poll_updated(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Value, Disconnected>>
fn poll_updated( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::Value, Disconnected>>
Polls for the next value, or returns
Disconnected
if one of the underlying
Watchable
s has been dropped.Source§fn updated(&mut self) -> NextFut<'_, Self> ⓘ
fn updated(&mut self) -> NextFut<'_, Self> ⓘ
Returns a future completing with
Ok(value)
once a new value is set, or with
Err(Disconnected)
if the connected Watchable
was dropped. Read moreSource§fn initialized<T, W>(&mut self) -> InitializedFut<'_, T, W, Self> ⓘ
fn initialized<T, W>(&mut self) -> InitializedFut<'_, T, W, Self> ⓘ
Source§fn stream(self) -> Stream<Self>where
Self: Unpin,
fn stream(self) -> Stream<Self>where
Self: Unpin,
Returns a stream which will yield the most recent values as items. Read more
Source§fn stream_updates_only(self) -> Stream<Self>where
Self: Unpin,
fn stream_updates_only(self) -> Stream<Self>where
Self: Unpin,
Returns a stream which will yield the most recent values as items, starting from
the next unobserved future value. Read more
Source§fn map<T: Clone + Eq>(
self,
map: impl Fn(Self::Value) -> T + Send + Sync + 'static,
) -> Map<Self, T>
fn map<T: Clone + Eq>( self, map: impl Fn(Self::Value) -> T + Send + Sync + 'static, ) -> Map<Self, T>
Maps this watcher with a function that transforms the observed values. Read more
fn filter<T>( self, filter: impl Fn(&T) -> bool + Send + Sync + 'static, ) -> Filter<Self, T>
Auto Trait Implementations§
impl<W, T> Freeze for Filter<W, T>
impl<W, T> !RefUnwindSafe for Filter<W, T>
impl<W, T> Send for Filter<W, T>
impl<W, T> Sync for Filter<W, T>
impl<W, T> Unpin for Filter<W, T>
impl<W, T> !UnwindSafe for Filter<W, T>
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