let h = thread::spawn(move || work()); h.join().unwrap();
Spawn and join a thread
let shared = Arc::new(Mutex::new(0));
Shared mutable state across threads
async fn fetch() -> u32 { } ... fetch().await
Async function (needs a runtime such as Tokio)
cargo new app / cargo run / cargo build --release
Create, run, and build a project
cargo test / cargo fmt / cargo clippy
Test, format, and lint
Cookies & your privacy
We use essential cookies to keep this site working and secure.
With your permission, we'd also like to use Google Analytics cookies to understand site traffic.
We don't use advertising or social media tracking cookies, and we honor Global Privacy Control (GPC) browser signals.
Learn more in our Privacy Policy.
Your browser is sending a GPC signal, so analytics stays off even if you accept.