use std::thread; pub trait Waitable: Sized { fn get_joinhandle(self) -> Option>; fn wait(self) { if let Some(handle) = self.get_joinhandle() { handle.join().expect("Couldn't join on thread!"); } else { log::warn!("Tried to wait on non-existent thread!"); } } }