DeveloperBreeze

Rust Functions Development Tutorials, Guides & Insights

Unlock 1+ expert-curated rust functions tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your rust functions skills on DeveloperBreeze.

Rust Cheatsheet

Cheatsheet August 29, 2024
rust

for i in &v {
    println!("{}", i);
}

for (key, value) in &scores {
    println!("{}: {}", key, value);
}
use std::thread;
use std::time::Duration;

fn main() {
    thread::spawn(|| {
        for i in 1..10 {
            println!("hi number {} from the spawned thread!", i);
            thread::sleep(Duration::from_millis(1));
        }
    });

    for i in 1..5 {
        println!("hi number {} from the main thread!", i);
        thread::sleep(Duration::from_millis(1));
    }
}