[−][src]Function async_watch2::channel
pub fn channel<T: Clone>(init: T) -> (Sender<T>, Receiver<T>)
Creates a new watch channel, returning the "send" and "receive" handles.
All values sent by Sender
will become visible to the Receiver
handles.
Only the last value sent is made available to the Receiver
half. All
intermediate values are dropped.
Examples
let (tx, mut rx) = async_watch2::channel("hello"); executor.spawn(async move { while let Some(value) = rx.recv().await { println!("received = {:?}", value); } }); tx.broadcast("world").unwrap();