n0_watcher

Struct Map

Source
pub struct Map<W: Watcher, T: Clone + Eq> { /* private fields */ }
Expand description

Wraps a Watcher to allow observing a derived value.

See Watcher::map.

Trait Implementations§

Source§

impl<W: Clone + Watcher, T: Clone + Clone + Eq> Clone for Map<W, T>
where W::Value: Clone,

Source§

fn clone(&self) -> Map<W, T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<W, T> Debug for Map<W, T>
where W: Debug + Watcher, T: Debug + Clone + Eq,

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<W: Watcher, T: Clone + Eq> Watcher for Map<W, T>

Source§

type Value = T

The type of value that can change. Read more
Source§

fn get(&mut self) -> Self::Value

Returns the current state of the underlying value. Read more
Source§

fn is_connected(&self) -> bool

Whether this watcher is still connected to all of its underlying Watchables. Read more
Source§

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 Watchables has been dropped.
Source§

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 more
Source§

fn initialized<T, W>(&mut self) -> InitializedFut<'_, T, W, Self>
where W: Nullable<T>, Self: Watcher<Value = W>,

Returns a future completing once the value is set to Some value. Read more
Source§

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,

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>

Maps this watcher with a function that transforms the observed values. Read more
Source§

fn filter<T>( self, filter: impl Fn(&T) -> bool + Send + Sync + 'static, ) -> Filter<Self, T>
where T: Clone + Eq, Self: Watcher<Value = T>,

Source§

fn or<W: Watcher>(self, other: W) -> (Self, W)

Returns a watcher that updates every time this or the other watcher updates, and yields both watcher’s items together when that happens.

Auto Trait Implementations§

§

impl<W, T> Freeze for Map<W, T>
where W: Freeze, T: Freeze,

§

impl<W, T> !RefUnwindSafe for Map<W, T>

§

impl<W, T> Send for Map<W, T>
where W: Send, T: Send,

§

impl<W, T> Sync for Map<W, T>
where W: Sync, T: Sync,

§

impl<W, T> Unpin for Map<W, T>
where W: Unpin, T: Unpin,

§

impl<W, T> !UnwindSafe for Map<W, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.