From 9fca5aa6f45519981eb776a74a0b550aedbdca2a Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Tue, 1 Oct 2024 11:54:55 -0400 Subject: [PATCH] Add a bit more detail about why we'd want a state machine enum --- src/ch17-01-futures-and-syntax.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ch17-01-futures-and-syntax.md b/src/ch17-01-futures-and-syntax.md index 0e6b35f76..368445136 100644 --- a/src/ch17-01-futures-and-syntax.md +++ b/src/ch17-01-futures-and-syntax.md @@ -281,7 +281,8 @@ keyword—represents a place where control gets handed back to the runtime. To make that work, Rust needs to keep track of the state involved in the async block, so that the runtime can kick off some other work and then come back when it is ready to try advancing this one again. This is an invisible state machine, -as if you wrote something like this: +as if you wrote an enum like this to save the current state at each `await` +point: ```rust {{#rustdoc_include ../listings/ch17-async-await/no-listing-state-machine/src/lib.rs:enum}}