pub struct Task<Version: TaskWarriorVersion + 'static = TW26> { /* 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.
As of taskwarrior version 2.6.0 and newer, the representation of depends
has changed from
being a comma seperated string of uuid’s to being a proper json array. You can select which
behaviour you want at compiletime by providing either TW26 (the default) or TW25 to Task
as its
type parameter.
Implementations§
Source§impl<Version: TaskWarriorVersion> Task<Version>
impl<Version: TaskWarriorVersion> Task<Version>
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<f64>,
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>,
urgency: Option<Urgency>,
uda: UDA,
) -> Task<Version>
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<f64>, 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>, urgency: Option<Urgency>, uda: UDA, ) -> Task<Version>
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>)
pub fn set_annotations<T, A>(&mut self, new: Option<T>)
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>)
pub fn set_depends<T, U>(&mut self, new: Option<T>)
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>)
pub fn set_modified<T>(&mut self, new: Option<T>)
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>)
pub fn set_parent<T>(&mut self, new: Option<T>)
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>)
pub fn set_project<T>(&mut self, new: Option<T>)
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>)
pub fn set_scheduled<T>(&mut self, new: Option<T>)
Set scheduled
Get the tags of the task
Get the tags of the task mutable
Set tags
Sourcepub fn urgency_mut(&mut self) -> Option<&mut Urgency>
pub fn urgency_mut(&mut self) -> Option<&mut Urgency>
Get the urgency of the task
Sourcepub fn set_urgency<T>(&mut self, new: Option<T>)
pub fn set_urgency<T>(&mut self, new: Option<T>)
Set the urgency of the task