An example of hand-written coroutines 143 The first thing you'll notice in the function body is that there is not much happening here. We only return Http Get Future and that's it. In the function signature, you see that it returns an object implementing the Future trait that outputs a String when it's resolved. The string we return from this function will be the response we get from the server. Now, we could have implemented the future trait directly on the Http struct, but I think it's a better design to allow one Http instance to give out multiple Futures instead of making the Http implement Future itself. Let's take a closer look at Http Get Future since there is much more happening there. Just to point this out so that there is no doubt going forward, Http Get Future is an example of a leaf future, and it will be the only leaf future we'll use in this example. Let's add the struct declaration to the file: ch07/a-coroutine/src/http. rs struct Http Get Future { stream: Option<mio::net::Tcp Stream>, buffer: Vec<u8>, path: String, } This data structure will hold onto some data for us: stream : This holds an Option<mio::net::Tcp Stream>. This will be an Option since we won't connect to the stream at the same point as we create this structure. buffer : We'll read the data from the Tcp Stream and put it all in this buffer until we've read all the data returned from the server. path : This simply stores the path for our GET request so we can use it later. The next thing we'll take a look at is the impl block for our Http Get Future : ch07/a-coroutine/src/http. rs impl Http Get Future { fn new(path: &'static str)-> Self { Self { stream: None, buffer: vec![], Path: path. to_string(), } }