Writing an OS in Rust: Async/Await
This is also just a fantastic introduction to async/await in Rust, regardless of the OS bits. Another amazing article by Phil.> The only requirement is that we use at least nightly 2020-03-25 of Rust because async/await was not no_std compatible before.There's some fun stuff here that's omitted (which makes sense, of course). It was always a design constraint of async/await in Rust that you could use it without the standard library. However, the initial implementation required thread local storage. The future trait's poll method took a &mut Context, and generators didn't support passing context in to them when resuming. This meant that the context would be placed in TLS, and would pull it back out when needed. Generators are unstable, partially for this reason. However, this was fixed, and that means TLS is no longer a requirement here! See https://github.com/rust-lang/rust/pull/68524 for more details.