MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / main

Function main

13_async/rust/std_async/src/main.rs:18–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17#[async_std::main]
18async fn main() {
19 a().await;
20 b().await;
21 println!("serial\n");
22
23 let result = a().join(b()).await;
24 println!("joined\n");
25 assert_eq!(result, (1u8, 2u8));
26
27 let result = a().race(b()).await; // often called `select`
28 println!("raced {:?}\n", result);
29
30 // `BoxedExt::boxed()` does `Box::pin(a()) as Pin<Box<dyn Future<Output = Foo>>>` for us
31 let futures: Vec<_> = vec![b().boxed(), a().boxed(), b().boxed()];
32 assert_eq!(join_all(futures).await, [2, 1, 2]);
33 println!("joined vector\n");
34}

Callers

nothing calls this directly

Calls 2

aFunction · 0.70
bFunction · 0.70

Tested by

no test coverage detected