Coroutines: C++ vs Rust
summary
Compares C++ coroutines using a user-defined promise type and std::coroutine_handle (compiler allocates a heap state by default, with optional elision) against Rust’s compiler-generated Future trait types driven by a waker and executor. Shows a working timer awaitable in C++ that resumes the innermost coroutine bottom‑up, contrasts Rust’s top‑down poll/wake model, explains pinning vs implicit heap allocation, and demonstrates the tail‑call / double‑destroy bugs and how continuations and final_suspend handle them.
AI-written summary · about
chapters (11)
- 0:00Start
- 4:42Main Loop
- 10:52Protein Handle
- 14:20User Interface
- 20:42Compiler Transformation
- 24:47Recap
- 27:14Variables and Resumers
- 51:49Common Operations
- 53:23Obligatory Socket Example
- 55:51Curtin Allocation
- 56:35Stackful Proteins
related talks
52mCoroutines: C++ vs Rust
58mAn Introduction to C++ Coroutines
01h 26mC++ Coroutines - Don’t Try This at Home
01h 31mC++ Coroutines Demystified
01h 27mManage Asynchronous Control Flow With C++ Coroutines
01h 02mC++20’s Coroutines for Beginners
57mCoroutine Intuition in C++
47mHow to start using coroutines
