Coroutines and async/await 148 If we wrote our program as an async function, it would look as follows: async fn async_main() { println!("Program starting") let txt = Http::get("/1000/Hello World"). await; println!("{txt}"); let txt2 = Http::("500/Hello World2"). await; println!("{txt2}"); } In main. rs, start by making the necessary imports and module declarations: ch07/a-coroutine/src/main. rs use std::time::Instant; mod future; mod http; use crate::http::Http; use future::{Future, Poll State}; The next thing we write is our stoppable/resumable task called Coroutine : ch07/a-coroutine/src/main. rs struct Coroutine { state: State, } Once that's done, we write the different states this task could be in: ch07/a-coroutine/src/main. rs enum State { Start, Wait1(Box<dyn Future<Output = String>>), Wait2(Box<dyn Future<Output = String>>), Resolved, } This specific coroutine can be in four states: Start : The Coroutine has been created but it hasn't been polled yet