multiple/
multiple.rs

1use std::time::Duration;
2
3use simple_async::{executor::Executor, futures::sleep};
4
5fn main() {
6    let executor = Executor::new();
7
8    executor.spawn(foo());
9    executor.spawn(bar());
10
11    executor.run();
12}
13
14async fn foo() {
15    println!("foo() starting");
16
17    sleep(Duration::from_millis(1000)).await;
18
19    println!("foo() done");
20}
21
22async fn bar() {
23    println!("bar() starting");
24
25    sleep(Duration::from_millis(2500)).await;
26
27    println!("bar() done");
28}