← All Exercises

Rust Async/Await

advancedrust~30min

Background

Rust async/await enables efficient concurrent I/O without threads, using futures and cooperative scheduling.

Problem

Write an async Rust function that fetches multiple URLs concurrently using tokio::join! and returns their statuses.

Input

Multiple URL strings to fetch concurrently.

Output

A vector of HTTP status codes from all responses.

Sample tests

Sample 1

Input: ["http://a.com", "http://b.com"]
Expected: [200, 200]

Your solution

Learning objective

Learn async/await syntax, tokio runtime, join_all for concurrent futures, and async function composition.