spawn_immortal

Function spawn_immortal 

Source
pub fn spawn_immortal<F, T>(f: F) -> JoinHandle<T>
where F: FnOnce() -> T + Send + Clone + 'static, T: Send + 'static,
Expand description

Use to spawn a thread that will be restarted automatically (after a one second delay) if it panics. Primarily useful for running an infinite-lifetime job (like a webserver) in another thread. If the passed function exits cleanly, it is not restarted.