liveBook · Manning

Join!

join! is an asynchronous macro that concurrently drives multiple futures and completes when all of them have completed.

How 2 Manning books explain it

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.

Read how Rust Servers, Services, and Apps explains join! →

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.

Read how Learn Rust in a Month of Lunches explains join! →

Related concepts

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.