1/6

thread::spawn starts a real OS thread and returns a JoinHandle<T>, where T is whatever the closure returns.

let h = thread::spawn(move || id * id);
let value = h.join().unwrap();

join() blocks until that thread finishes and gives you its return value — wrapped in a Result, because the thread may have panicked. Err means the panic; unwrap() here propagates it into the parent.