Iterates over all finished jobs, returning the job state and the result.
(
&mut self,
)
| 68 | |
| 69 | /// Iterates over all finished jobs, returning the job state and the result. |
| 70 | pub fn iter_finished( |
| 71 | &mut self, |
| 72 | ) -> impl Iterator<Item = (&mut JobState, std::thread::Result<JobResult>)> + '_ { |
| 73 | self.jobs.iter_mut().filter_map(|job| { |
| 74 | if let Some(handle) = &job.handle { |
| 75 | if !handle.is_finished() { |
| 76 | return None; |
| 77 | } |
| 78 | let result = job.handle.take().unwrap().join(); |
| 79 | return Some((job, result)); |
| 80 | } |
| 81 | None |
| 82 | }) |
| 83 | } |
| 84 | |
| 85 | /// Clears all finished jobs. |
| 86 | pub fn clear_finished(&mut self) { |
no test coverage detected