fn perform_step(&mut self) -> Option<Step> {
        let non_completed_steps = self.prerequisites
            .iter()
            .filter(|(step, _prereqs)| {
                !self.completed.contains(step)
            });

        let non_completed_steps_with_all_prerequisites_satisfied = non_completed_steps
            .filter(|(_step, prerequisities)| {
                prerequisities.iter().all(|prereq| self.completed.contains(prereq))
            });

        let step_to_perform = non_completed_steps_with_all_prerequisites_satisfied
            .map(|(step, _prereqs)| *step)
            .min();

        if let Some(step) = step_to_perform { self.completed.insert(step); }

        step_to_perform
    }
/// Performs a step and returns the step which was performed
/// If no steps are possible, or all steps are complete, returns None
Performs a step and returns the step which was performed
If no steps are possible, or all steps are complete, returns None
Performs a step and returns the step which was performed If no steps are possible or all steps are complete returns None
fn perform_step(&mut self) -> Option<Step> {
        let non_completed_steps = self.prerequisites
            .iter()
            .filter(|(step, _prereqs)| {
                !self.completed.contains(step)
            });
        let non_completed_steps_with_all_prerequisites_satisfied = non_completed_steps
            .filter(|(_step, prerequisities)| {
                prerequisities.iter().all(|prereq| self.completed.contains(prereq))
            });
        let step_to_perform = non_completed_steps_with_all_prerequisites_satisfied
            .map(|(step, _prereqs)| *step)
            .min();
        if let Some(step) = step_to_perform { self.completed.insert(step); }
        step_to_perform
    }
fn perform_step ( & mut self ) -> Option < Step > { let non_completed_steps = self . prerequisites . iter ( ) . filter ( | ( step , _prereqs ) | { ! self . completed . contains ( step ) } ) ; let non_completed_steps_with_all_prerequisites_satisfied = non_completed_steps . filter ( | ( _step , prerequisities ) | { prerequisities . iter ( ) . all ( | prereq | self . completed . contains ( prereq ) ) } ) ; let step_to_perform = non_completed_steps_with_all_prerequisites_satisfied . map ( | ( step , _prereqs ) | * step ) . min ( ) ; if let Some ( step ) = step_to_perform { self . completed . insert ( step ) ; } step_to_perform }
Performs a step and returns the step which was performed
If no steps are possible, or all steps are complete, returns None
Performs a step and returns the step which was performed If no steps are possible or all steps are complete returns None
&mut self
&mut self