5/5
# `join!` and `select!` macros ## Example Execute the following command to run [`./solutions/examples/select.rs`](https://github.com/Cyfrin/rust-crash-course/blob/main/topics/join_select/solutions/examples/select.rs) ```shell cargo run --example select ``` ## Exercises Exercises are in [`./exercises/src/main.rs`](https://github.com/Cyfrin/rust-crash-course/blob/main/topics/join_select/exercises/src/main.rs) ### Exercise 1 Get ETH and BTC prices from exchange 1 concurrently. ### Exercise 2 Get ETH prices from exchange 1 and 2, returning as soon one price is returned. ## Test ```shell cargo run ```
join!
and select!
macrosExecute the following command to run ./solutions/examples/select.rs
Exercises are in ./exercises/src/main.rs
Get ETH and BTC prices from exchange 1 concurrently.
Get ETH prices from exchange 1 and 2, returning as soon one price is returned.
A practical guide to `join!` and `select!` macros - Learn to coordinate multiple asynchronous tasks in Rust using `join!` for concurrent execution and `select!` for racing futures. Apply these patterns by fetching ETH and BTC prices, either simultaneously from one exchange or the fastest ETH price from two.
Previous lesson
Previous
Give us feedback
Course Overview
About the course
Introduction to the Rust programming language
Rust variables and functions
Scalar types, arrays, strings, enum, structs, vectors, and hash maps in Rust
Rust control flows: If / else, if let and let else, loop, match
Rust ownership, including borrow and references
Rust error handling
Rust Modules
Rust Traits
Last updated on July 11, 2025
Rust Developer
Rust Programming BasicsDuration: 6min
Duration: 18min
Duration: 47min
Duration: 15min
Duration: 19min
Duration: 8min
Duration: 12min
Duration: 46min
Duration: 14min
Course Overview
About the course
Introduction to the Rust programming language
Rust variables and functions
Scalar types, arrays, strings, enum, structs, vectors, and hash maps in Rust
Rust control flows: If / else, if let and let else, loop, match
Rust ownership, including borrow and references
Rust error handling
Rust Modules
Rust Traits
Last updated on July 11, 2025