]> git.lizzy.rs Git - rust.git/blobdiff - crates/rust-analyzer/src/thread_pool.rs
Replaced fold with for loop
[rust.git] / crates / rust-analyzer / src / thread_pool.rs
index 4fa5029253db09516c4270ae2a8c28da1bc929e3..83389373903221fae63de9f15b88336076a759a4 100644 (file)
@@ -23,6 +23,17 @@ pub(crate) fn spawn<F>(&mut self, task: F)
         })
     }
 
+    pub(crate) fn spawn_with_sender<F>(&mut self, task: F)
+    where
+        F: FnOnce(Sender<T>) + Send + 'static,
+        T: Send + 'static,
+    {
+        self.inner.execute({
+            let sender = self.sender.clone();
+            move || task(sender)
+        })
+    }
+
     pub(crate) fn len(&self) -> usize {
         self.inner.queued_count()
     }