pub struct Receiver<'a, M: RawMutex, T: Clone, const N: usize>(/* private fields */);Expand description
A receiver of a Watch channel.
Implementations§
Source§impl<'a, M: RawMutex, T: Clone, const N: usize> Receiver<'a, M, T, N>
 
impl<'a, M: RawMutex, T: Clone, const N: usize> Receiver<'a, M, T, N>
Sourcepub fn as_dyn(self) -> DynReceiver<'a, T>
 
pub fn as_dyn(self) -> DynReceiver<'a, T>
Converts the Receiver into a DynReceiver.
Methods from Deref<Target = Rcv<'a, T, Watch<M, T, N>>>§
Sourcepub fn get(&mut self) -> impl Future<Output = T> + '_
 
pub fn get(&mut self) -> impl Future<Output = T> + '_
Returns the current value of the Watch once it is initialized, marking it as seen.
Note: Futures do nothing unless you .await or poll them.
Sourcepub fn try_get(&mut self) -> Option<T>
 
pub fn try_get(&mut self) -> Option<T>
Tries to get the current value of the Watch without waiting, marking it as seen.
Sourcepub async fn get_and<F>(&mut self, f: F) -> T
 
pub async fn get_and<F>(&mut self, f: F) -> T
Returns the value of the Watch if it matches the predicate function f,
or waits for it to match, marking it as seen.
Note: Futures do nothing unless you .await or poll them.
Sourcepub fn try_get_and<F>(&mut self, f: F) -> Option<T>
 
pub fn try_get_and<F>(&mut self, f: F) -> Option<T>
Tries to get the current value of the Watch if it matches the predicate
function f without waiting, marking it as seen.
Sourcepub async fn changed(&mut self) -> T
 
pub async fn changed(&mut self) -> T
Waits for the Watch to change and returns the new value, marking it as seen.
Note: Futures do nothing unless you .await or poll them.
Sourcepub fn try_changed(&mut self) -> Option<T>
 
pub fn try_changed(&mut self) -> Option<T>
Tries to get the new value of the watch without waiting, marking it as seen.
Sourcepub async fn changed_and<F>(&mut self, f: F) -> T
 
pub async fn changed_and<F>(&mut self, f: F) -> T
Waits for the Watch to change to a value which satisfies the predicate
function f and returns the new value, marking it as seen.
Note: Futures do nothing unless you .await or poll them.
Sourcepub fn try_changed_and<F>(&mut self, f: F) -> Option<T>
 
pub fn try_changed_and<F>(&mut self, f: F) -> Option<T>
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.
Sourcepub fn contains_value(&self) -> bool
 
pub fn contains_value(&self) -> bool
Checks if the Watch contains a value. If this returns true,
then awaiting Rcv::get will return immediately.