Coroutines and async/await 142 HTTP module In this module, we'll implement a very simple HTTP client. This client can only make GET requests to our delayserver since we just use this as a representation of a typical I/O operation and don't care specifically about being able to do more than we need. The first thing we'll do is import some types and traits from the standard library as well as our Futures module: ch07/a-coroutine/src/http. rs use crate::future::{Future, Poll State}; use std::io::{Error Kind, Read, Write}; Next, we create a small helper function to write our HTTP requests. We've used this exact bit of code before in this book, so I'll not spend time explaining it again here: ch07/a-coroutine/src/http. rs fn get_req(path: &str)-> String { format!( "GET {path} HTTP/1. 1\r\n\ Host: localhost\r\n\ Connection: close\r\n\ \r\n" ) } So, now we can start writing our HTTP client. The implementation is very short and simple: pub struct Http; impl Http { pub fn get(path: &str)-> impl Future<Output = String> { Http Get Future::new(path) } } We don't really need a struct here, but we add one since we might want to add some state at a later point. It's also a good way to group functions belonging to the HTTP client together. Our HTTP client only has one function, get, which, eventually, will send a GET request to our delayserver with the path we specify (remember that the path is everything in bold in this example URL: http://127. 0. 0. 1:8080 /1000/Hello World),