std-type

ScopedJoinHandle: explicit scoped join

An explicit scoped join yields the result and permits handling the worker panic yourself. If a panicking worker is left to automatic joining, the scope itself panics under unwinding. Expected stdout (not executed): 6 Common mistake: Assuming scope always suppresses a worker panic.

Formal Syntax & Structure

rust syntaxrust
ScopedJoinHandle<'scope, T>; handle.join()

Working Example

Example Snippetrust
fn main() {    let text = String::from("scoped");    std::thread::scope(|s| {        let h = s.spawn(|| text.len());        println!("{}", h.join().unwrap());    });}
Rust Reference