Improving our example 1-variables 221 Hmm, this is interesting. I've highlighted the changes we need to make. The first thing we do is to restore the stack by taking ownership over the counter ( take() replaces the value currently stored in self. stack. counter with None in this case) and writing it to a variable with the same name that we used in the code segment ( counter ). Taking ownership and placing the value back in later is not an issue in this case and it mimics the code we wrote in our coroutine/wait example. The next change is simply the segment that takes all the code after the first wait point and pastes it in. In this case, the only change is that the counter variable is increased by 1. Lastly, we save the stack state back so that we hold onto its updated state between the wait points. Note In Chapter 5, we saw how we needed to store/restore the register state in our fibers. Since Chapter 5 showed an example of a stackful coroutine implementation, we didn't have to care about stack state at all since all the needed state was stored in the stacks we created. Since our coroutines are stackless, we don't store the entire call stack for each coroutine, but we do need to store/restore the parts of the stack that will be used across wait points. Stackless coroutines still need to save some information from the stack, as we've done here. When we enter the State0::Wait2 state, we start the same way: ch09/a-coroutines-variables/src/main. rs State0::Wait2(ref mut f2) => { match f2. poll(waker) { Poll State::Ready(txt) => { // Restore stack let mut counter = self. stack. counter. take(). unwrap(); //----Code you actually wrote---- println!("{txt}"); counter += 1; println!(«Received {} responses. », counter); //--------------------------------- self. state = State0::Resolved; // Save stack (all variables set to None already) break Poll State::Ready(String::new());