diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-04-27 22:19:55 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-05-04 17:33:33 +0200 |
commit | 99023fb40fc98e6e629d15100be1d8e6afeab243 (patch) | |
tree | 3ffffc13e675381bd5b4393c084644ad38f9e63a | |
parent | 5499b0da437a2d237803ef6734d3a0da9aa66337 (diff) |
Add documentation for Annotation type
-rw-r--r-- | src/annotation.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/annotation.rs b/src/annotation.rs index 7d0ff83..4c7c8e9 100644 --- a/src/annotation.rs +++ b/src/annotation.rs @@ -11,6 +11,9 @@ use serde::de::MapVisitor as DeserializeMapVisitor; use date::Date; +/// Annotation type for task annotations. +/// Each annotation in taskwarrior consists of a date and a description, +/// the date is named "entry", the description "description" in the JSON export. #[derive(Clone, Debug)] pub struct Annotation { entry: Date, @@ -19,6 +22,7 @@ pub struct Annotation { impl Annotation { + /// Create a new Annotation object pub fn new(entry: Date, description: String) -> Annotation { Annotation { entry: entry, @@ -26,10 +30,12 @@ impl Annotation { } } + /// Get the entry date pub fn entry(&self) -> &Date { &self.entry } + /// Get the description text pub fn description(&self) -> &String { &self.description } @@ -49,6 +55,7 @@ impl Serialize for Annotation { } +/// Helper type for the `Serialize` implementation struct AnnotationVisitor<'a> { value: &'a Annotation, state: u8, @@ -91,6 +98,7 @@ impl Deserialize for Annotation { } +/// Helper type for the `Deserialize` implementation struct AnnotationDeserializeVisitor; impl Visitor for AnnotationDeserializeVisitor { |