Async Rust
Async Rust is Rust’s future-driven model for cooperative concurrency, typically executed by Tokio and shaped by cancellation, Send, pinning, and task-lifetime rules.
Concepts
- Futures
- async and await
- The Tokio Runtime
- Tasks and spawn
- select!
- Pinning
- Streams
- Cancellation Safety
- Async Traits
- Async Closures
- Shared State in Async
Patterns
- spawn_blocking
- Structured Task Sets with JoinSet
- Async Message Passing
- Scoping Non-Send Values Before Await
- LocalSet and Non-Send Futures
- Async Timeouts
- O
Antipatterns
- Blocking the Async Executor
- Holding Locks Across Await
- Fire-and-Forget Tokio Tasks
- Non-Cancellation-Safe select! Branches
See also
Futures · async and await · The Tokio Runtime · Tasks and spawn · select! · Pinning · Streams · Cancellation Safety
Sources
- The Rust Programming Language, ch. 17 “Fundamentals of Asynchronous Programming” — the-book, https://doc.rust-lang.org/book/ch17-00-async-await.html
- Rust standard library,
Future— https://doc.rust-lang.org/std/future/trait.Future.html - Rust standard library,
std::pin— https://doc.rust-lang.org/std/pin/
