Borrowing

    1. use tokio::sync::oneshot;
    2. async fn main() {
    3. let (tx1, rx1) = oneshot::channel();
    4. let (tx2, rx2) = oneshot::channel();
    5. tokio::spawn(async move {
    6. // Send values on `tx1` and `tx2`.
    7. });
    8. tokio::select! {
    9. _ = rx1 => {
    10. }
    11. _ = rx2 => {
    12. out.push_str("rx2 completed");
    13. }
    14. }