pub fn tasks_in_statuses(
        &mut self,
        statuses: Vec<TaskStatus>,
        task_ids: Option<Vec<usize>>,
    ) -> (Vec<usize>, Vec<usize>) {
        let task_ids = match task_ids {
            Some(ids) => ids,
            None => self.tasks.keys().cloned().collect(),
        };

        let mut matching = Vec::new();
        let mut mismatching = Vec::new();

        // Filter all task id's that match the provided statuses.
        for task_id in task_ids.iter() {
            // Check whether the task exists and save all non-existing task ids.
            match self.tasks.get(&task_id) {
                None => {
                    mismatching.push(*task_id);
                    continue;
                }
                Some(task) => {
                    // Check whether the task status matches the specified statuses.
                    if statuses.contains(&task.status) {
                        matching.push(*task_id);
                    } else {
                        mismatching.push(*task_id);
                    }
                }
            };
        }

        (matching, mismatching)
    }
/// This checks, whether the given task_ids are in the specified statuses.
/// The first result is the list of task_ids that match these statuses.
/// The second result is the list of task_ids that don't match these statuses.
///
/// Additionally, a list of task_ids can be specified to only run the check
/// on a subset of all tasks.
This checks, whether the given task_ids are in the specified statuses.
The first result is the list of task_ids that match these statuses.
The second result is the list of task_ids that don't match these statuses.

Additionally, a list of task_ids can be specified to only run the check
on a subset of all tasks.
This checks whether the given task_ids are in the specified statuses . The first result is the list of task_ids that match these statuses . The second result is the list of task_ids that don ' t match these statuses . Additionally a list of task_ids can be specified to only run the check on a subset of all tasks .
pub fn tasks_in_statuses(
        &mut self,
        statuses: Vec<TaskStatus>,
        task_ids: Option<Vec<usize>>,
    ) -> (Vec<usize>, Vec<usize>) {
        let task_ids = match task_ids {
            Some(ids) => ids,
            None => self.tasks.keys().cloned().collect(),
        };
        let mut matching = Vec::new();
        let mut mismatching = Vec::new();
        // Filter all task id's that match the provided statuses.
        for task_id in task_ids.iter() {
            // Check whether the task exists and save all non-existing task ids.
            match self.tasks.get(&task_id) {
                None => {
                    mismatching.push(*task_id);
                    continue;
                }
                Some(task) => {
                    // Check whether the task status matches the specified statuses.
                    if statuses.contains(&task.status) {
                        matching.push(*task_id);
                    } else {
                        mismatching.push(*task_id);
                    }
                }
            };
        }
        (matching, mismatching)
    }
pub fn tasks_in_statuses ( & mut self , statuses : Vec < TaskStatus > , task_ids : Option < Vec < usize > > , ) -> ( Vec < usize > , Vec < usize > ) { let task_ids = match task_ids { Some ( ids ) => ids , None => self . tasks . keys ( ) . cloned ( ) . collect ( ) , } ; let mut matching = Vec :: new ( ) ; let mut mismatching = Vec :: new ( ) ; // Filter all task id's that match the provided statuses. for task_id in task_ids . iter ( ) { // Check whether the task exists and save all non-existing task ids. match self . tasks . get ( & task_id ) { None => { mismatching . push ( * task_id ) ; continue ; } Some ( task ) => { // Check whether the task status matches the specified statuses. if statuses . contains ( & task . status ) { matching . push ( * task_id ) ; } else { mismatching . push ( * task_id ) ; } } } ; } ( matching , mismatching ) }
This checks, whether the given task_ids are in the specified statuses.
This checks whether the given task_ids are in the specified statuses .
&mut self
statuses
Vec<TaskStatus>
task_ids
Option<Vec<usize>>