Jon Gjengset teaches the mental model and intuition for using async/await in Rust, covering futures, cancellation, and executors.
Finally, we tackle the topic of async/await in Rust, and specifically looking at how to use and think about async/await more so than how it works under the hood. My hope with this video is to convey the mental model and intuition you should use when using async/await in your own code, without getting bogged down in the details of Future, Pin, and Wakers.
Introduction
Fixing the video title
What is async fn?
awaiting futures
Yielding
Awaiting one of multiple futures
Cancellation
Executing futures
Select arms with side-effects
Cooperative scheduling
Selects with many arms
Fused futures
Overhead of async
Is select a future?
Awaiting multiple futures
Parallelism and spawning
Sharing across spawn
Runtime discovery
Stack variables in async
Async fn in traits
Asynchronous Mutexes
Do futures stay on a thread?
Async stack traces
Wrapping up
The async book: rust-lang.github.io/async-book/
Tokio's mini-redis: github.com/tokio-rs/mini-redis/
Live version with chat: youtu.be/CaCYL11_qEU
Why it's here
2 people recommend this
What people say. Highly recommended as an essential deep dive for understanding the mental model of asynchronous programming in Rust.
S
SnowProblemon Hacker News • Recommends
On “Learning Async Rust with Too Many Web Servers”
Impressive! Especially the part on async where they built up the Future trait and runtime from first principles. If it interests you, these two videos are also great deep dives into Rust async 12. Rust's model is a little different from other languages in a powerful way. 1link2link to this video
there is a chapter on async in comprehensive rust and rustbook which ought to bring you up to speed there is the async book but it is largely unfinished you can watch John Gjengset's crust of rust async, decrusting tokio, and why what, and how of pinning in rust then there are tokio-lessons and tokio tutorial which teach how to use tokio runtime and there are also good blogposts by phil-oop and rose wright on how async works linklinklinklink to this videolinklinklinklinklinklink
…managed to implement as a zero-cost abstraction. Impressive, but still a bad idea. I'm sure the pro of having a BDFL instead of a committee is being able to follow a singular vision, instead of trying to appease members by adding the fad du jour which might stray a little too far from the original vision. Too many chefs in the kitchen and all. 1: link to this video…