Coroutines, Self-Referential Structs, and Pinning 224 The only other thing we need to change is the Future::poll implementation: ch09/b-coroutines-references/src/main. rs State0::Start => { // initialize stack (hoist variables) self. stack. buffer = Some(String::from("\n BUFFER:\ n----\n")); self. stack. writer = Some(self. stack. buffer. as_ mut(). unwrap()); //----Code you actually wrote---- println!("Program starting"); //--------------------------------- let fut1 = Box::new(http::Http::get("/600/ Hello Async Await")); self. state = State0::Wait1(fut1); // save stack } Okay, so this looks a bit odd. The first line we change is pretty straightforward. We initialize our buffer variable to a new String type, just like we did at the top of our coroutine/wait program. The next line, however, looks a bit dangerous. We cast the &mut reference to our buffer to a *mut pointer. Important Y es, I know we could have chosen another way of doing this since we can take a reference to buffer everywhere we need to instead of storing it in its variable, but that's only because our example is very simple. Imagine that we use a library that needs to borrow data that's local to the async function and we somehow have to manage the lifetimes manually like we do here but in a much more complex scenario. The self. stack. buffer. as_mut(). unwrap() line returns a &mut reference to the buffer field. Since self. stack. writer is of the Option<*mut String> type, the reference will be coerced to a pointer (meaning that Rust does this cast implicitly by inferring it from the context). Note We take *mut String here since we deliberately don't want a string slice (&str ), which is often what we get (and want) when using a reference to a String type in Rust.