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

        r.recv().map_err(|_| ThreadPoolDisconnected)
    }
/// Execute the given job and block the current thread until finished.
/// If you need a non blocking method, see `ThreadPoolAsyncHandler`.
Execute the given job and block the current thread until finished.
If you need a non blocking method, see `ThreadPoolAsyncHandler`.
Execute the given job and block the current thread until finished . If you need a non blocking method see ` ThreadPoolAsyncHandler ` .
pub fn execute<F, R>(&self, f: F) -> Result<R, ThreadPoolDisconnected>
    where
        F: 'static + Send + FnOnce(&Shared) -> R,
        R: 'static + Send,
    {
        let (s, r) = flume::bounded(1);
        self.sender
            .send(MsgForWorker::NewJob(Box::new(move |shared| {
                let _ = s.send(f(shared));
            })))
            .map_err(|_| ThreadPoolDisconnected)?;
        r.recv().map_err(|_| ThreadPoolDisconnected)
    }
pub fn execute < F , R > ( & self , f : F ) -> Result < R , ThreadPoolDisconnected > where F : ' static + Send + FnOnce ( & Shared ) -> R , R : ' static + Send , { let ( s , r ) = flume :: bounded ( 1 ) ; self . sender . send ( MsgForWorker :: NewJob ( Box :: new ( move | shared | { let _ = s . send ( f ( shared ) ) ; } ) ) ) . map_err ( | _ | ThreadPoolDisconnected ) ? ; r . recv ( ) . map_err ( | _ | ThreadPoolDisconnected ) }
Execute the given job and block the current thread until finished.
Execute the given job and block the current thread until finished .
&self
f
F
&self
f
F