fn main() { let mut h = Vec::new(); for t in 1..5 { fn body(n: i32) { for i in 1..10 { println!("Thread {}, Count {}", n, i); std::thread::sleep(std::time::Duration::from_millis(100)); } } let thread_body = move || body(t); h.push(std::thread::spawn(thread_body)); } println!("Main thread, here!"); for t in h { t.join(); } }