pub fn channel<T: Send + Sync + 'static>(init: T) -> (Sender<T>, Receiver<T>)Expand description
Creates a new watch channel around init, returning the send and receive
handles.
All values sent by the Sender become visible to the Receiver
handles; only the last value sent is kept, and the ones before it are
dropped. The initial value counts as seen by the first receiver.
use nuclei::sync::watch;
let (tx, rx) = watch::channel(0u32);
tx.send(1).unwrap();
assert_eq!(*rx.borrow(), 1);