Future: an async fn returns a Future — a state machine describing work that is not done yet. It does nothing until an executor polls it, advancing it toward completion.
2 / 5
Why are Rust futures described as lazy?
Lazy futures: unlike some languages where async work starts immediately, a Rust Future is inert until driven by an executor. Simply calling an async fn does not begin the computation; you must .await or spawn it.
3 / 5
What does the Tokio runtime provide?
Tokio runtime: the executor that polls futures, a scheduler for tasks, and an event loop (reactor) that wakes futures when their I/O is ready. It powers most async Rust networking applications.
4 / 5
What does tokio::spawn do?
spawn: hands a future to the runtime to execute concurrently, returning a JoinHandle. This lets many tasks make progress on a small thread pool without blocking each other.
5 / 5
Why should you avoid blocking calls inside an async task?
Blocking in async: async runtimes run many tasks per thread. A synchronous blocking call (heavy CPU work, blocking I/O) ties up that thread, starving other tasks. Use spawn_blocking for such work.