রাস্ট (Rust) হলো একটি আধুনিক সিস্টেম প্রোগ্রামিং ভাষা যা নিরাপত্তা, গতি, এবং সমান্তরালতার (concurrency) উপর জোর দেয়। এই চিটশিটে রাস্টের সব মৌলিক থেকে উন্নত ধারণা, সিনট্যাক্স, এবং ব্যবহার বিস্তারিতভাবে কভার করা হয়েছে।
use std::thread;use std::time::Duration;fn main() { let handle = thread::spawn(|| { for i in 1..5 { println!("থ্রেড: {}", i); thread::sleep(Duration::from_millis(100)); } }); for i in 1..3 { println!("মেইন: {}", i); thread::sleep(Duration::from_millis(100)); } handle.join().unwrap();}
use std::sync::{Mutex, Arc};fn main() { let counter = Arc::new(Mutex::new(0)); let mut handles = vec![]; for _ in 0..3 { let counter = Arc::clone(&counter); let handle = thread::spawn(move || { let mut num = counter.lock().unwrap(); *num += 1; }); handles.push(handle); } for handle in handles { handle.join().unwrap(); } println!("গণনা: {}", *counter.lock().unwrap());}