n0_watcher

Struct Direct

Source
pub struct Direct<T> { /* private fields */ }
Expand description

The immediate, direct observer of a Watchable value.

This type is mainly used via the Watcher interface.

Trait Implementations§

Source§

impl<T: Clone> Clone for Direct<T>

Source§

fn clone(&self) -> Direct<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<T: Debug> Debug for Direct<T>

Source§

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

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

impl<T: Clone + Eq> Watcher for Direct<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<T> Freeze for Direct<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Direct<T>
where T: RefUnwindSafe,

§

impl<T> Send for Direct<T>
where T: Send + Sync,

§

impl<T> Sync for Direct<T>
where T: Sync + Send,

§

impl<T> Unpin for Direct<T>
where T: Unpin,

§

impl<T> UnwindSafe for Direct<T>
where T: UnwindSafe,

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.