pub fn launch<F, R>(&self, f: F) -> Result<JoinHandle<R>, ThreadPoolDisconnected>
    where
        F: 'static + Send + FnOnce(&Shared) -> R,
        R: 'static + Send,
    {
        let (s, r) = flume::bounded(1);
        let s_clone = s.clone();
        self.sender
            .send(MsgForWorker::NewJob(Box::new(move |shared| {
                let _ = s_clone.send(f(shared));
            })))
            .map_err(|_| ThreadPoolDisconnected)?;

        Ok(JoinHandle(s, r))
    }
/// Launch the given job and return a oneshot receiver that listen job result.
/// If you need a non blocking method, see `ThreadPoolAsyncHandler`.
Launch the given job and return a oneshot receiver that listen job result.
If you need a non blocking method, see `ThreadPoolAsyncHandler`.
Launch the given job and return a oneshot receiver that listen job result . If you need a non blocking method see ` ThreadPoolAsyncHandler ` .
pub fn launch<F, R>(&self, f: F) -> Result<JoinHandle<R>, ThreadPoolDisconnected>
    where
        F: 'static + Send + FnOnce(&Shared) -> R,
        R: 'static + Send,
    {
        let (s, r) = flume::bounded(1);
        let s_clone = s.clone();
        self.sender
            .send(MsgForWorker::NewJob(Box::new(move |shared| {
                let _ = s_clone.send(f(shared));
            })))
            .map_err(|_| ThreadPoolDisconnected)?;
        Ok(JoinHandle(s, r))
    }
pub fn launch < F , R > ( & self , f : F ) -> Result < JoinHandle < R > , ThreadPoolDisconnected > where F : ' static + Send + FnOnce ( & Shared ) -> R , R : ' static + Send , { let ( s , r ) = flume :: bounded ( 1 ) ; let s_clone = s . clone ( ) ; self . sender . send ( MsgForWorker :: NewJob ( Box :: new ( move | shared | { let _ = s_clone . send ( f ( shared ) ) ; } ) ) ) . map_err ( | _ | ThreadPoolDisconnected ) ? ; Ok ( JoinHandle ( s , r ) ) }
Launch the given job and return a oneshot receiver that listen job result.
Launch the given job and return a oneshot receiver that listen job result .
&self
f
F
&self
f
F