I want to create a thread inside of the new method and stop it after the struct is destroyed:
new
use std::thread; struct Foo { handle: thread:
The problem in join signature:
join
fn join(self) -> Result
so to fix your code, you need something like:
pub fn stop(self) { self.handle.join(); }