Struct Task

Source
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>

Source

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

Source

pub fn id(&self) -> Option<u64>

Get the id of the task

Source

pub fn status(&self) -> &TaskStatus

Get the status of the task

Source

pub fn status_mut(&mut self) -> &mut TaskStatus

Get the status of the task mutable

Source

pub fn uuid(&self) -> &Uuid

Get the uuid of the task

Source

pub fn uuid_mut(&mut self) -> &mut Uuid

Get the uuid of the task mutable

Source

pub fn entry(&self) -> &Date

Get the entry date of the task

Source

pub fn entry_mut(&mut self) -> &mut Date

Get the entry date of the task mutable

Source

pub fn description(&self) -> &String

Get the description of the task

Source

pub fn description_mut(&mut self) -> &mut String

Get the description of the task mutable

Source

pub fn annotations(&self) -> Option<&Vec<Annotation>>

Get the annotations of the task

Source

pub fn annotations_mut(&mut self) -> Option<&mut Vec<Annotation>>

Get the annotations of the task mutable

Source

pub fn set_annotations<T, A>(&mut self, new: Option<T>)

Set annotations

Source

pub fn depends(&self) -> Option<&Vec<Uuid>>

Get the dependencies of the task

Source

pub fn depends_mut(&mut self) -> Option<&mut Vec<Uuid>>

Get the dependencies of the task mutable

Source

pub fn set_depends<T, U>(&mut self, new: Option<T>)
where T: IntoIterator, T::Item: Into<Uuid>,

Set depends

Source

pub fn due(&self) -> Option<&Date>

Get the due date of the task

Source

pub fn due_mut(&mut self) -> Option<&mut Date>

Get the due date of the task mutable

Source

pub fn set_due<T>(&mut self, new: Option<T>)
where T: Into<Date>,

Set due

Source

pub fn end(&self) -> Option<&Date>

Get the end date of the task

Source

pub fn end_mut(&mut self) -> Option<&mut Date>

Get the end date of the task mutable

Source

pub fn set_end<T>(&mut self, new: Option<T>)
where T: Into<Date>,

Set end

Source

pub fn imask(&self) -> Option<&f64>

Get the imask of the task

Source

pub fn imask_mut(&mut self) -> Option<&mut f64>

Get the imask of the task mutable

Source

pub fn set_imask<T>(&mut self, new: Option<T>)
where T: Into<f64>,

Set imask

Source

pub fn mask(&self) -> Option<&String>

Get the mask of the task

Source

pub fn mask_mut(&mut self) -> Option<&mut String>

Get the mask of the task mutable

Source

pub fn set_mask<T>(&mut self, new: Option<T>)
where T: Into<String>,

Set mask

Source

pub fn modified(&self) -> Option<&Date>

Get the modified date of the task

Source

pub fn modified_mut(&mut self) -> Option<&mut Date>

Get the modified date of the task mutable

Source

pub fn set_modified<T>(&mut self, new: Option<T>)
where T: Into<Date>,

Set modified

Source

pub fn parent(&self) -> Option<&Uuid>

Get the parent of the task

Source

pub fn parent_mut(&mut self) -> Option<&mut Uuid>

Get the parent of the task mutable

Source

pub fn set_parent<T>(&mut self, new: Option<T>)
where T: Into<Uuid>,

Set parent

Source

pub fn priority(&self) -> Option<&TaskPriority>

Get the priority of the task

Source

pub fn priority_mut(&mut self) -> Option<&mut TaskPriority>

Get the priority of the task mutable

Source

pub fn set_priority<T>(&mut self, new: Option<T>)
where T: Into<TaskPriority>,

Set priority

Source

pub fn project(&self) -> Option<&Project>

Get the project of the task

Source

pub fn project_mut(&mut self) -> Option<&mut Project>

Get the project of the task mutable

Source

pub fn set_project<T>(&mut self, new: Option<T>)
where T: Into<Project>,

Set project

Source

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.

Source

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

Source

pub fn set_recur<T>(&mut self, new: Option<T>)
where T: Into<String>,

Set recur

Source

pub fn scheduled(&self) -> Option<&Date>

Get the scheduled date of the task

Source

pub fn scheduled_mut(&mut self) -> Option<&mut Date>

Get the scheduled date of the task mutable

Source

pub fn set_scheduled<T>(&mut self, new: Option<T>)
where T: Into<Date>,

Set scheduled

Source

pub fn start(&self) -> Option<&Date>

Get the start date of the task

Source

pub fn start_mut(&mut self) -> Option<&mut Date>

Get the start date of the task mutable

Source

pub fn set_start<T>(&mut self, new: Option<T>)
where T: Into<Date>,

Set start

Source

pub fn tags(&self) -> Option<&Vec<Tag>>

Get the tags of the task

Source

pub fn tags_mut(&mut self) -> Option<&mut Vec<Tag>>

Get the tags of the task mutable

Source

pub fn set_tags<T>(&mut self, new: Option<T>)
where T: IntoIterator, T::Item: Into<Tag>,

Set tags

Source

pub fn until(&self) -> Option<&Date>

Get the until date of the task

Source

pub fn until_mut(&mut self) -> Option<&mut Date>

Get the until date of the task mutable

Source

pub fn set_until<T>(&mut self, new: Option<T>)
where T: Into<Date>,

Set until

Source

pub fn urgency(&self) -> Option<&Urgency>

Get the urgency of the task

Source

pub fn urgency_mut(&mut self) -> Option<&mut Urgency>

Get the urgency of the task

Source

pub fn set_urgency<T>(&mut self, new: Option<T>)
where T: Into<Urgency>,

Set the urgency of the task

Source

pub fn wait(&self) -> Option<&Date>

Get the wait date of the task

Source

pub fn wait_mut(&mut self) -> Option<&mut Date>

Get the wait date of the task mutable

Source

pub fn set_wait<T>(&mut self, new: Option<T>)
where T: Into<Date>,

Set wait

Source

pub fn uda(&self) -> &UDA

Get the BTreeMap that contains the UDA

Source

pub fn uda_mut(&mut self) -> &mut UDA

Get the BTreeMap that contains the UDA mutable

Trait Implementations§

Source§

impl<Version: Clone + TaskWarriorVersion + 'static> Clone for Task<Version>

Source§

fn clone(&self) -> Task<Version>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Version: Debug + TaskWarriorVersion + 'static> Debug for Task<Version>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, Version: TaskWarriorVersion + 'static> Deserialize<'de> for Task<Version>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Version: PartialEq + TaskWarriorVersion + 'static> PartialEq for Task<Version>

Source§

fn eq(&self, other: &Task<Version>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Version: TaskWarriorVersion + 'static> Serialize for Task<Version>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<Version: TaskWarriorVersion + 'static> StructuralPartialEq for Task<Version>

Auto Trait Implementations§

§

impl<Version> Freeze for Task<Version>

§

impl<Version> RefUnwindSafe for Task<Version>
where Version: RefUnwindSafe,

§

impl<Version> Send for Task<Version>
where Version: Send,

§

impl<Version> Sync for Task<Version>
where Version: Sync,

§

impl<Version> Unpin for Task<Version>
where Version: Unpin,

§

impl<Version> UnwindSafe for Task<Version>
where Version: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,