Recommended with reservations.
This is a substantial book if you’re the right audience. If the phrase “let’s implement the standard libraries and Tokio by ourselves to see how it can work at a lower level” puts you off, then this probably isn’t the book for you: yes, you could use it just to find out how to use modern Rust language facilities, or even just for its explanation of Non-leaf and leaf Futures and how async
and await
work across multiple programming languages (not just Rust), but you’ll be skipping a lot of material if that’s your only interest. It feels almost like a ‘literate programming’ presentation of an implementation, some of it going low level (there is x86-64 assembly and plentiful use of the unsafe
keyword). The discussion on moving and pinning in Rust is interesting although it’s hard for me to see where else a ‘normal’ programmer might use this (if ever).
There are some flaws. There are typos, one affecting a URL in the text, and at one point a long figure legend with important information is written by hand, causing it to be omitted by audio screen readers (I’m reviewing the PDF and can’t comment on the book’s physical form). Also the ‘History’ section sometimes had me saying, “That’s not how I remember it”. For example, anyone who thinks there was essentially no multitasking before Windows needs to look up the history of Unix on mainframes: ‘hyperthreading’ is an Intel-specific commercial name for what is more generically called simultaneous multithreading, which was released in 2002, not the 1990s. The book doesn’t really explain instruction level parallelism and why slots are not consistently available in the superscalar pipelines. As another example, the discussion of fragmented stack frames and hardware prefetching applies only to certain architectures depending how good the prefetcher is. Overall, though, these do not let the book down very much, especially if you’re focusing on the implementation. But do be aware that this book is an in-depth description of a specific implementation, not just giving you a tutorial for how to use the standard libraries. The free book The Rust Programming Language at https://doc.rust-lang.org/book can help with that in its chapters 16, 17 and 21.
Website: https://www.packtpub.com/en-gb/product/asynchronous-programming-in-rust-9781805128137
Code site: https://github.com/PacktPublishing/Asynchronous-Programming-in-Rust