pub fn spawn<F>(f: F) -> Self
    where
        F: FnOnce(mpsc::Receiver<()>) -> T,
        F: Send + 'static,
    {
        let (tx_stop, rx_stop) = mpsc::channel();
        let join_handle = thread::spawn(move || f(rx_stop));

        Self {
            join_handle,
            tx_stop,
        }
    }
/// Spawns a stoppable thread with the provided function.
Spawns a stoppable thread with the provided function.
Spawns a stoppable thread with the provided function .
pub fn spawn<F>(f: F) -> Self
    where
        F: FnOnce(mpsc::Receiver<()>) -> T,
        F: Send + 'static,
    {
        let (tx_stop, rx_stop) = mpsc::channel();
        let join_handle = thread::spawn(move || f(rx_stop));
        Self {
            join_handle,
            tx_stop,
        }
    }
pub fn spawn < F > ( f : F ) -> Self where F : FnOnce ( mpsc :: Receiver < ( ) > ) -> T , F : Send + ' static , { let ( tx_stop , rx_stop ) = mpsc :: channel ( ) ; let join_handle = thread :: spawn ( move | | f ( rx_stop ) ) ; Self { join_handle , tx_stop , } }
Spawns a stoppable thread with the provided function.
Spawns a stoppable thread with the provided function .
f
F