diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-09-18 10:18:53 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-09-18 10:18:53 +0300 |
commit | afeeb2276df2907f5db901ddc30ff0ac7f05c84f (patch) | |
tree | 1779de7a8a3c7c51157af52d849a2dd63fe28777 /src | |
parent | 6cc8825abb6252512941b4e04ef049c5c8d58fdf (diff) | |
download | roadmap-afeeb2276df2907f5db901ddc30ff0ac7f05c84f.tar.gz |
Change: make struct members private
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -1,7 +1,7 @@ pub struct Step { - pub name: String, - pub label: String, - pub depends: Vec<String>, + name: String, + label: String, + depends: Vec<String>, } impl Step { @@ -12,10 +12,22 @@ impl Step { depends: vec![], } } + + pub fn name(self) -> String { + self.name.to_string() + } + + pub fn label(self) -> String { + self.label.to_string() + } + + pub fn depends(self) -> Vec<String> { + self.depends.clone() + } } pub struct Roadmap { - pub steps: Vec<Step>, + steps: Vec<Step>, } impl Roadmap { @@ -27,6 +39,14 @@ impl Roadmap { None } + pub fn steps(self) -> Vec<String> { + let mut names = vec![]; + for step in self.steps { + names.push(step.name()); + } + names + } + pub fn get_step(self, _name: &str) -> Option<Step> { None } |