diff options
Diffstat (limited to 'src/map.rs')
-rw-r--r-- | src/map.rs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -25,9 +25,14 @@ impl Roadmap { Roadmap { steps: vec![] } } + // Find steps that nothing depends on. + fn goals(&self) -> Vec<&Step> { + self.steps.iter().filter(|step| self.is_goal(step)).collect() + } + /// Count number of steps that nothing depends on. pub fn count_goals(&self) -> usize { - self.steps.iter().filter(|step| self.is_goal(step)).count() + self.goals().len() } /// Iterate over step names. |