File: main.rs

package info (click to toggle)
rust-interprocess 2.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,016 kB
  • sloc: makefile: 2
file content (21 lines) | stat: -rw-r--r-- 510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#[cfg(feature = "tokio")]
mod side_a;
#[cfg(feature = "tokio")]
mod side_b;

#[cfg(feature = "tokio")]
#[tokio::main]
async fn main() -> std::io::Result<()> {
    use tokio::{sync::oneshot, task};

    let (htx, hrx) = oneshot::channel();
    let jh = task::spawn(side_a::emain(htx));
    let handle = hrx.await.unwrap();

    side_b::emain(handle).await?;
    jh.await.unwrap()
}
#[cfg(not(feature = "tokio"))]
fn main() {
    eprintln!("This example is not available when the Tokio feature is disabled.");
}