embassy-sync

Crates

git

Versions

default

Flavors

embassy_sync::watch

Struct AnonRcv

Source
pub struct AnonRcv<'a, T: Clone, W: WatchBehavior<T> + ?Sized> { /* private fields */ }
Expand description

A anonymous receiver can NOT .await a change in the Watch value.

Implementations§

Source§

impl<'a, T: Clone, W: WatchBehavior<T> + ?Sized> AnonRcv<'a, T, W>

Source

pub fn try_get(&mut self) -> Option<T>

Tries to get the current value of the Watch without waiting, marking it as seen.

Source

pub fn try_get_and<F>(&mut self, f: F) -> Option<T>
where F: Fn(&T) -> bool,

Tries to get the current value of the Watch if it matches the predicate function f without waiting, marking it as seen.

Source

pub fn try_changed(&mut self) -> Option<T>

Tries to get the new value of the watch without waiting, marking it as seen.

Source

pub fn try_changed_and<F>(&mut self, f: F) -> Option<T>
where F: Fn(&T) -> bool,

Tries to get the new value of the watch which satisfies the predicate function f and returns the new value without waiting, marking it as seen.

Source

pub fn contains_value(&self) -> bool

Checks if the Watch contains a value. If this returns true, then awaiting Rcv::get will return immediately.

Auto Trait Implementations§

§

impl<'a, T, W> Freeze for AnonRcv<'a, T, W>
where W: ?Sized,

§

impl<'a, T, W> RefUnwindSafe for AnonRcv<'a, T, W>

§

impl<'a, T, W> Send for AnonRcv<'a, T, W>
where W: Sync + ?Sized, T: Send,

§

impl<'a, T, W> Sync for AnonRcv<'a, T, W>
where W: Sync + ?Sized, T: Sync,

§

impl<'a, T, W> Unpin for AnonRcv<'a, T, W>
where T: Unpin, W: ?Sized,

§

impl<'a, T, W> UnwindSafe for AnonRcv<'a, T, W>
where W: RefUnwindSafe + ?Sized, 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> 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, 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.