/// Returns a future that is ready when the notification is set.
/// Takes ownership of self to make it easy for callers to create a temporary
/// Notification clone that lives for the duration of when_set().await.
Returns a future that is ready when the notification is set.
Takes ownership of self to make it easy for callers to create a temporary
Notification clone that lives for the duration of when_set().await.
Returns a future that is ready when the notification is set . Takes ownership of self to make it easy for callers to create a temporary Notification clone that lives for the duration of when_set () . await .
pub async fn when_set(self) {
        // Clone to avoid holding an exclusive mutable borrow on self.recv.
        let mut recv = self.inner.recv.clone();
        // Note from tokio::sync::watch::Receiver:
        //
        //    If this is the first time [recv] is called on a `Receiver`
        //    instance, then [recv] completes immediately with the **current**
        //    value held by the channel. On the next call, [recv] waits until
        //    a new value is sent in the channel.
        //
        // Hence if the first recv call returns false, we should try again.
        loop {
            match recv.recv().await {
                Some(true) => return,
                Some(false) => continue,
                // Cannot happen: None means the sender was dropped, but self must
                // outlive the sender.
                None => panic!("impossible"),
            }
        }
    }
pub async fn when_set ( self ) { // Clone to avoid holding an exclusive mutable borrow on self.recv. let mut recv = self . inner . recv . clone ( ) ; // Note from tokio::sync::watch::Receiver: // //    If this is the first time [recv] is called on a `Receiver` //    instance, then [recv] completes immediately with the **current** //    value held by the channel. On the next call, [recv] waits until //    a new value is sent in the channel. // // Hence if the first recv call returns false, we should try again. loop { match recv . recv ( ) . await { Some ( true ) => return , Some ( false ) => continue , // Cannot happen: None means the sender was dropped, but self must // outlive the sender. None => panic ! ( " " ) , } } }
Returns a future that is ready when the notification is set.
Returns a future that is ready when the notification is set .
self