(
state_ref: &StateRef,
selector: &IdSelector,
include_running_tasks: bool,
)
| 660 | } |
| 661 | |
| 662 | fn compute_job_info( |
| 663 | state_ref: &StateRef, |
| 664 | selector: &IdSelector, |
| 665 | include_running_tasks: bool, |
| 666 | ) -> ToClientMessage { |
| 667 | let state = state_ref.get(); |
| 668 | |
| 669 | let jobs: Vec<_> = match selector { |
| 670 | IdSelector::All => state |
| 671 | .jobs() |
| 672 | .map(|j| j.make_job_info(include_running_tasks)) |
| 673 | .collect(), |
| 674 | IdSelector::LastN(n) => state |
| 675 | .last_n_ids(*n) |
| 676 | .filter_map(|id| state.get_job(id)) |
| 677 | .map(|j| j.make_job_info(include_running_tasks)) |
| 678 | .collect(), |
| 679 | IdSelector::Specific(array) => array |
| 680 | .iter() |
| 681 | .filter_map(|id| state.get_job(JobId::new(id))) |
| 682 | .map(|j| j.make_job_info(include_running_tasks)) |
| 683 | .collect(), |
| 684 | }; |
| 685 | ToClientMessage::JobInfoResponse(JobInfoResponse { jobs }) |
| 686 | } |
| 687 | |
| 688 | async fn handle_job_cancel( |
| 689 | state_ref: &StateRef, |
no test coverage detected