use std::thread::{Builder, JoinHandle}; /// Like `thread::spawn`, but with a `name` argument. pub fn spawn_named(name: S, f: F) -> JoinHandle where F: FnOnce() -> T + Send + 'static, T: Send + 'static, S: Into, { Builder::new().name(name.into()).spawn(f).expect("thread spawn works") }