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.
15 lines
391 B
15 lines
391 B
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); |
|
}
|
|
|