diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-05-03 11:40:14 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-05-03 11:40:14 +0200 |
commit | 5788ae50dd280ac1f6abfcb44227d70265db58e3 (patch) | |
tree | ce448759fc887fa2c1a4a69bb5c83d161b4936a9 | |
parent | c4b135ee3d089e3eb95028c154e3083c5667bbeb (diff) | |
parent | 74066bd7909c2331bd6d50103f9e724528a8fabf (diff) |
Merge pull request #20 from matthiasbeyer/feat/add-annotation
Feat/add annotation
-rw-r--r-- | src/task.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/task.rs b/src/task.rs index b67cb94..8aaae17 100644 --- a/src/task.rs +++ b/src/task.rs @@ -117,6 +117,23 @@ impl Task { self.annotations.as_ref() } + pub fn add_annotation(&mut self, an: Annotation) { + if self.annotations.is_none() { + self.annotations = Some(vec![an]); + } else { + match self.annotations.as_mut() { + Some(ref mut anno) => anno.push(an), + _ => unreachable!(), + } + } + } + + pub fn add_annotations<I: Iterator<Item = Annotation>>(&mut self, i: I) { + for item in i { + self.add_annotation(item) + } + } + pub fn depends(&self) -> Option<&String> { self.depends.as_ref() } |