Debian Codegraph @

examples/async.rs

raw symbols SCIP
1 #[cfg(all(feature = "async", not(target_os = "unknown")))]
2 #[async_std::main]
3 async fn main() {
4 let (tx, rx) = flume::bounded(1);
5
6 let t = async_std::task::spawn(async move {
7 while let Ok(msg) = rx.recv_async().await {
8 println!("Received: {}", msg);
9 }
10 });
11
12 tx.send_async("Hello, world!").await.unwrap();
13 tx.send_async("How are you today?").await.unwrap();
14
15 drop(tx);
16
17 t.await;
18 }
19
20 #[cfg(any(not(feature = "async"), target_os = "unknown"))]
21 fn main() {}