pub fn current() -> Thread
Gets a handle to the thread that invokes it.
Getting a handle to the current thread with thread::current()
:
use std::thread; let handler = thread::Builder::new() .name("named thread".into()) .spawn(|| { let handle = thread::current(); assert_eq!(handle.name(), Some("named thread")); }) .unwrap(); handler.join().unwrap();
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/thread/fn.current.html