You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
391 B
16 lines
391 B
2 years ago
|
use tokio::sync::mpsc;
|
||
|
|
||
|
#[tokio::main(flavor = "current_thread")]
|
||
|
async fn main() {
|
||
|
let (tx, mut rx) = mpsc::channel(2);
|
||
|
if let Err(_) = tx.send(2).await {
|
||
|
println!("Failed to send message");
|
||
|
}
|
||
|
if let Err(_) = tx.send(3).await {
|
||
|
println!("Failed to send second message");
|
||
|
}
|
||
|
|
||
|
let response = rx.recv().await;
|
||
|
println!("Response: {:?}", response);
|
||
|
}
|