Struct task_hookrs::task::Task
source · pub struct Task { /* private fields */ }
Expand description
Task type
A task must have four things:
- A Status
- An UUID
- An Entry-Date
- A Description
all other Data is optional by taskwarrior. This type is a simple rust representation of the JSON exported by taskwarrior.
For further explanations of the fields please consult the documentation on https://taskwarrior.org/
It is deserializeable and serializeable via serde_json, so importing and exporting taskwarrior tasks is simply serializing and deserializing objects of this type.
Implementations
sourceimpl Task
impl Task
sourcepub fn new(
id: Option<u64>,
status: TaskStatus,
uuid: Uuid,
entry: Date,
description: String,
annotations: Option<Vec<Annotation>>,
depends: Option<Vec<Uuid>>,
due: Option<Date>,
end: Option<Date>,
imask: Option<i64>,
mask: Option<String>,
modified: Option<Date>,
parent: Option<Uuid>,
priority: Option<TaskPriority>,
project: Option<Project>,
recur: Option<String>,
scheduled: Option<Date>,
start: Option<Date>,
tags: Option<Vec<Tag>>,
until: Option<Date>,
wait: Option<Date>,
uda: UDA
) -> Task
pub fn new(
id: Option<u64>,
status: TaskStatus,
uuid: Uuid,
entry: Date,
description: String,
annotations: Option<Vec<Annotation>>,
depends: Option<Vec<Uuid>>,
due: Option<Date>,
end: Option<Date>,
imask: Option<i64>,
mask: Option<String>,
modified: Option<Date>,
parent: Option<Uuid>,
priority: Option<TaskPriority>,
project: Option<Project>,
recur: Option<String>,
scheduled: Option<Date>,
start: Option<Date>,
tags: Option<Vec<Tag>>,
until: Option<Date>,
wait: Option<Date>,
uda: UDA
) -> Task
Create a new Task instance
sourcepub fn status(&self) -> &TaskStatus
pub fn status(&self) -> &TaskStatus
Get the status of the task
sourcepub fn status_mut(&mut self) -> &mut TaskStatus
pub fn status_mut(&mut self) -> &mut TaskStatus
Get the status of the task mutable
sourcepub fn description(&self) -> &String
pub fn description(&self) -> &String
Get the description of the task
sourcepub fn description_mut(&mut self) -> &mut String
pub fn description_mut(&mut self) -> &mut String
Get the description of the task mutable
sourcepub fn annotations(&self) -> Option<&Vec<Annotation>>
pub fn annotations(&self) -> Option<&Vec<Annotation>>
Get the annotations of the task
sourcepub fn annotations_mut(&mut self) -> Option<&mut Vec<Annotation>>
pub fn annotations_mut(&mut self) -> Option<&mut Vec<Annotation>>
Get the annotations of the task mutable
sourcepub fn set_annotations<T, A>(&mut self, new: Option<T>)where
T: IntoIterator,
T::Item: Into<Annotation>,
pub fn set_annotations<T, A>(&mut self, new: Option<T>)where
T: IntoIterator,
T::Item: Into<Annotation>,
Set annotations
sourcepub fn depends_mut(&mut self) -> Option<&mut Vec<Uuid>>
pub fn depends_mut(&mut self) -> Option<&mut Vec<Uuid>>
Get the dependencies of the task mutable
sourcepub fn set_depends<T, U>(&mut self, new: Option<T>)where
T: IntoIterator,
T::Item: Into<Uuid>,
pub fn set_depends<T, U>(&mut self, new: Option<T>)where
T: IntoIterator,
T::Item: Into<Uuid>,
Set depends
sourcepub fn modified_mut(&mut self) -> Option<&mut Date>
pub fn modified_mut(&mut self) -> Option<&mut Date>
Get the modified date of the task mutable
sourcepub fn set_modified<T>(&mut self, new: Option<T>)where
T: Into<Date>,
pub fn set_modified<T>(&mut self, new: Option<T>)where
T: Into<Date>,
Set modified
sourcepub fn parent_mut(&mut self) -> Option<&mut Uuid>
pub fn parent_mut(&mut self) -> Option<&mut Uuid>
Get the parent of the task mutable
sourcepub fn set_parent<T>(&mut self, new: Option<T>)where
T: Into<Uuid>,
pub fn set_parent<T>(&mut self, new: Option<T>)where
T: Into<Uuid>,
Set parent
sourcepub fn priority(&self) -> Option<&TaskPriority>
pub fn priority(&self) -> Option<&TaskPriority>
Get the priority of the task
sourcepub fn priority_mut(&mut self) -> Option<&mut TaskPriority>
pub fn priority_mut(&mut self) -> Option<&mut TaskPriority>
Get the priority of the task mutable
sourcepub fn set_priority<T>(&mut self, new: Option<T>)where
T: Into<TaskPriority>,
pub fn set_priority<T>(&mut self, new: Option<T>)where
T: Into<TaskPriority>,
Set priority
sourcepub fn project_mut(&mut self) -> Option<&mut Project>
pub fn project_mut(&mut self) -> Option<&mut Project>
Get the project of the task mutable
sourcepub fn set_project<T>(&mut self, new: Option<T>)where
T: Into<Project>,
pub fn set_project<T>(&mut self, new: Option<T>)where
T: Into<Project>,
Set project
sourcepub fn recur(&self) -> Option<&String>
pub fn recur(&self) -> Option<&String>
Get the recur of the task
This is exported as String by now. This might change in future versions of this crate.
sourcepub fn recur_mut(&mut self) -> Option<&mut String>
pub fn recur_mut(&mut self) -> Option<&mut String>
This is exported as String by now. This might change in future versions of this crate. mutable
sourcepub fn scheduled_mut(&mut self) -> Option<&mut Date>
pub fn scheduled_mut(&mut self) -> Option<&mut Date>
Get the scheduled date of the task mutable
sourcepub fn set_scheduled<T>(&mut self, new: Option<T>)where
T: Into<Date>,
pub fn set_scheduled<T>(&mut self, new: Option<T>)where
T: Into<Date>,
Set scheduled
Get the tags of the task
Get the tags of the task mutable
Set tags