summaryrefslogtreecommitdiffstats
path: root/src/annotation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/annotation.rs')
-rw-r--r--src/annotation.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/annotation.rs b/src/annotation.rs
index 7d0ff83..d50aca6 100644
--- a/src/annotation.rs
+++ b/src/annotation.rs
@@ -1,3 +1,5 @@
+//! Module containing types and functions for annotations of tasks
+
use std::result::Result as RResult;
use serde::Serialize;
@@ -11,6 +13,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 +24,7 @@ pub struct Annotation {
impl Annotation {
+ /// Create a new Annotation object
pub fn new(entry: Date, description: String) -> Annotation {
Annotation {
entry: entry,
@@ -26,10 +32,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 +57,7 @@ impl Serialize for Annotation {
}
+/// Helper type for the `Serialize` implementation
struct AnnotationVisitor<'a> {
value: &'a Annotation,
state: u8,
@@ -91,6 +100,7 @@ impl Deserialize for Annotation {
}
+/// Helper type for the `Deserialize` implementation
struct AnnotationDeserializeVisitor;
impl Visitor for AnnotationDeserializeVisitor {