()
| 96 | } |
| 97 | |
| 98 | fn main() { |
| 99 | let (executor, spawner) = new_executor_and_spawner(); |
| 100 | |
| 101 | // Spawn a task to print before and after waiting on a timer. |
| 102 | spawner.spawn(async { |
| 103 | println!("howdy!"); |
| 104 | // Wait for our timer future to complete after two seconds |
| 105 | TimerFuture::new(Duration::new(2, 0)).await; |
| 106 | println!("done!"); |
| 107 | }); |
| 108 | |
| 109 | // Drop the spawner so that our executor knows it is finished and won't |
| 110 | // receive more incoming tasks to run. |
| 111 | drop(spawner); |
| 112 | |
| 113 | // Run the executor until the task queue is empty. |
| 114 | // This will print "howdy!", pause, and then print "done!". |
| 115 | executor.run(); |
| 116 | } |
nothing calls this directly
no test coverage detected