11. Concurrency (Async/Await) {#11-concurrency-asyncawait}

July 5, 2026 ยท View on GitHub

+++ title = "11. Concurrency (Async/Await)" weight = 11 +++

11. Concurrency (Async/Await) {#11-concurrency-asyncawait}

Built on pthreads.

async fn fetch_data() -> string {
    // Runs in background
    return "Data";
}

fn main() {
    let future = fetch_data();
    let result = await future;
}