Join!
join! is an asynchronous macro that concurrently drives multiple futures and returns their outputs when all have completed.
Rust Servers, Services, and Apps
The Rust join macro drives multiple asynchronous computations and completes after all of them complete.
- How it is used
- Coordinates multiple Tokio tasks in an asynchronous program and delays continuation until all tasks finish.
- How deep it goes
- Explains completion, lazy async functions, awaiting, spawning, and scheduling, but does not develop macro internals.
- Examples
- Uses two simulated file-reading tasks whose four-second and two-second delays produce observable completion ordering.
- What you can do after
- Apply it via Tokio to wait for multiple spawned asynchronous operations in an async main function.
Learn Rust in a Month of Lunches
join! is an asynchronous macro that concurrently drives multiple futures and completes when all of them complete.
- How it is used
- Runs independent futures concurrently when asynchronous code should make progress together rather than await each operation sequentially.
- How deep it goes
- Defines concurrent polling through a runnable example, but stops short of explaining the macro's implementation internals.
- Examples
- Demonstrates three randomly delayed numeric futures whose print order varies while their tuple result stays ordered.
- What you can do after
- Apply concurrent future polling with Tokio's join! macro and recognize its ordered tuple result.
Also covered in
What to know first
- threadA thread is an execution sequence or context within a program or process that represents a unit of work and can run or be scheduled independently of other threads.
Related concepts
- futureuses · A future is an abstraction representing an asynchronous computation’s result, which may become available later and may be pending or complete.
- concurrencyused by · Concurrency is the structuring or execution of multiple computational activities so their progress overlaps in time, whether or not they run simultaneously.
- Tokioused by · Tokio is a Rust asynchronous runtime and library that provides task scheduling and facilities for asynchronous I/O.
Questions about join!
What is join!?
join! is an asynchronous macro that concurrently drives multiple futures and returns their outputs when all have completed.
Which Manning books explain join!?
Rust Servers, Services, and Apps and Learn Rust in a Month of Lunches.
What should I know before learning join!?
Manning books that teach join! usually introduce thread first.
What is the difference between join! and join?
join! is an asynchronous macro that concurrently drives multiple futures and returns their outputs when all have completed. A thread or process join operation blocks the caller until a specified concurrent execution completes.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

