std::thread::spawn starts a child thread and returns a JoinHandle. When JoinHandle is dropped (e.g. at the end of the function that started the thread), the child thread is detached. This means that the main thread of your program can finish before waiting for the child threads that it started. And when main thread finishes, the whole process will terminate (without waiting for child threads). If you want the program to wait for child threads, you'll need to call JoinHandle::join. An example from the docs:
use std::thread;
let handler = thread::spawn(|| {
// thread code
});
handler.join().unwrap();
Perhaps you could make a minimal example on play.rust-lang.org and include a link to it here so we can try out the code ourselves? The code you have posted is clearly not complete, and we can't give any advice if the problem lies outside the code you posted.