diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-03-20 08:25:39 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-03-20 08:25:39 +0200 |
commit | 97654c1795dfb9e84792713911475310e4bc1a86 (patch) | |
tree | 9f696add2ce6933a5e40564d5644cd36a9da1297 /src/map.rs | |
parent | 57dcf6f8da0060d29b96cb542a9f679ae57d10f8 (diff) | |
download | roadmap-97654c1795dfb9e84792713911475310e4bc1a86.tar.gz |
Refactor: add Roadmap.goals
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. |