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