diff --git a/src/jobs.rs b/src/jobs.rs index 5804b6b2..62fde1d9 100644 --- a/src/jobs.rs +++ b/src/jobs.rs @@ -214,6 +214,14 @@ impl JobExecutor { (receiver, JoinHandle(handle), job_id) } + + pub fn spawn_blocking(&self, future: F) -> (oneshot::Receiver, JoinHandle, JobId) + where + F: Future + Send + 'static, + R: Send + 'static, + { + self.spawn_specialized(smol::Task::blocking(async move { future.await })) + } } pub type JobChannel = oneshot::Receiver>;