()
| 2569 | /// Runs work on the background on a specific worker thread. |
| 2570 | /// |
| 2571 | /// This is quite similar to [`spawn`], except that the work will run on another |
| 2572 | /// worker instead of the current one. |
| 2573 | /// |
| 2574 | /// If not called within a thread pool, this uses the [`DEFAULT_POOL`]. |
| 2575 | /// |
| 2576 | /// If you have a reference to a [`Worker`], it's better to use |
| 2577 | /// [`Worker::spawn_on`] instead. If you don't have a worker, but know which |
| 2578 | /// thread pool you want to use, [`ThreadPool::spawn_on`] is more appropriate. |
| 2579 | pub fn spawn_on<M, S>(member_index: usize, work: S) -> S::Output |
| 2580 | where |
| 2581 | S: Spawn<M> + Send, |
| 2582 | S::Output: Send, |
| 2583 | { |
| 2584 | Worker::with_current(|worker| match worker { |
| 2585 | Some(worker) => worker.spawn_on(member_index, work), |
| 2586 | None => DEFAULT_POOL.spawn_on(member_index, work), |
nothing calls this directly
no test coverage detected