Struct taskchampion::TaskMut
source · pub struct TaskMut<'r> { /* private fields */ }
Expand description
Implementations§
source§impl<'r> TaskMut<'r>
impl<'r> TaskMut<'r>
sourcepub fn into_immut(self) -> Task
pub fn into_immut(self) -> Task
Get the immutable version of this object, ending the exclusive reference to the Replica.
sourcepub fn set_status(&mut self, status: Status) -> Result<(), Error>
pub fn set_status(&mut self, status: Status) -> Result<(), Error>
Set the task’s status. This also adds the task to the working set if the new status puts it in that set.
pub fn set_description(&mut self, description: String) -> Result<(), Error>
pub fn set_priority(&mut self, priority: String) -> Result<(), Error>
pub fn set_entry(&mut self, entry: Option<DateTime<Utc>>) -> Result<(), Error>
pub fn set_wait(&mut self, wait: Option<DateTime<Utc>>) -> Result<(), Error>
pub fn set_modified(&mut self, modified: DateTime<Utc>) -> Result<(), Error>
sourcepub fn set_value<S: Into<String>>(
&mut self,
property: S,
value: Option<String>
) -> Result<(), Error>
pub fn set_value<S: Into<String>>( &mut self, property: S, value: Option<String> ) -> Result<(), Error>
Set a tasks’s property by name.
This will not automatically update the modified
timestamp or perform any other
“automatic” operations – it simply sets the property. Howerver, if property is
“modified”, then subsequent calls to other set_..
methods will not update the
modified
timestamp.
sourcepub fn start(&mut self) -> Result<(), Error>
pub fn start(&mut self) -> Result<(), Error>
Start the task by creating “start”: “
sourcepub fn delete(&mut self) -> Result<(), Error>
pub fn delete(&mut self) -> Result<(), Error>
Mark this task as deleted.
Note that this does not delete the task. It merely marks the task as deleted.
sourcepub fn add_tag(&mut self, tag: &Tag) -> Result<(), Error>
pub fn add_tag(&mut self, tag: &Tag) -> Result<(), Error>
Add a tag to this task. Does nothing if the tag is already present.
sourcepub fn remove_tag(&mut self, tag: &Tag) -> Result<(), Error>
pub fn remove_tag(&mut self, tag: &Tag) -> Result<(), Error>
Remove a tag from this task. Does nothing if the tag is not present.
sourcepub fn add_annotation(&mut self, ann: Annotation) -> Result<(), Error>
pub fn add_annotation(&mut self, ann: Annotation) -> Result<(), Error>
Add a new annotation. Note that annotations with the same entry time will overwrite one another.
sourcepub fn remove_annotation(&mut self, entry: DateTime<Utc>) -> Result<(), Error>
pub fn remove_annotation(&mut self, entry: DateTime<Utc>) -> Result<(), Error>
Remove an annotation, based on its entry time.
pub fn set_due(&mut self, due: Option<DateTime<Utc>>) -> Result<(), Error>
sourcepub fn set_uda(
&mut self,
namespace: impl AsRef<str>,
key: impl AsRef<str>,
value: impl Into<String>
) -> Result<(), Error>
pub fn set_uda( &mut self, namespace: impl AsRef<str>, key: impl AsRef<str>, value: impl Into<String> ) -> Result<(), Error>
Set a user-defined attribute (UDA). This will fail if the key is defined by the data model.
sourcepub fn remove_uda(
&mut self,
namespace: impl AsRef<str>,
key: impl AsRef<str>
) -> Result<(), Error>
pub fn remove_uda( &mut self, namespace: impl AsRef<str>, key: impl AsRef<str> ) -> Result<(), Error>
Remove a user-defined attribute (UDA). This will fail if the key is defined by the data model.
sourcepub fn set_legacy_uda(
&mut self,
key: impl Into<String>,
value: impl Into<String>
) -> Result<(), Error>
pub fn set_legacy_uda( &mut self, key: impl Into<String>, value: impl Into<String> ) -> Result<(), Error>
Set a user-defined attribute (UDA), where the key is a legacy key.
Methods from Deref<Target = Task>§
pub fn get_uuid(&self) -> Uuid
pub fn get_taskmap(&self) -> &TaskMap
pub fn get_status(&self) -> Status
pub fn get_description(&self) -> &str
pub fn get_entry(&self) -> Option<DateTime<Utc>>
pub fn get_priority(&self) -> &str
sourcepub fn get_wait(&self) -> Option<DateTime<Utc>>
pub fn get_wait(&self) -> Option<DateTime<Utc>>
Get the wait time. If this value is set, it will be returned, even if it is in the past.
sourcepub fn is_waiting(&self) -> bool
pub fn is_waiting(&self) -> bool
Determine whether this task is waiting now.
sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Determine whether this task is active – that is, that it has been started and not stopped.
sourcepub fn is_blocked(&self) -> bool
pub fn is_blocked(&self) -> bool
Determine whether this task is blocked – that is, has at least one unresolved dependency.
sourcepub fn is_blocking(&self) -> bool
pub fn is_blocking(&self) -> bool
Determine whether this task is blocking – that is, has at least one unresolved dependent.
Iterate over the task’s tags
sourcepub fn get_annotations(&self) -> impl Iterator<Item = Annotation> + '_
pub fn get_annotations(&self) -> impl Iterator<Item = Annotation> + '_
Iterate over the task’s annotations, in arbitrary order.
sourcepub fn get_uda(&self, namespace: &str, key: &str) -> Option<&str>
pub fn get_uda(&self, namespace: &str, key: &str) -> Option<&str>
Get the named user defined attributes (UDA). This will return None for any key defined in the Task data model, regardless of whether it is set or not.
sourcepub fn get_udas(&self) -> impl Iterator<Item = ((&str, &str), &str)> + '_
pub fn get_udas(&self) -> impl Iterator<Item = ((&str, &str), &str)> + '_
Get the user defined attributes (UDAs) of this task, in arbitrary order. Each key is split
on the first .
character. Legacy keys that do not contain .
are represented as ("", key)
.
sourcepub fn get_legacy_uda(&self, key: &str) -> Option<&str>
pub fn get_legacy_uda(&self, key: &str) -> Option<&str>
Get the named user defined attribute (UDA) in a legacy format. This will return None for any key defined in the Task data model, regardless of whether it is set or not.
sourcepub fn get_legacy_udas(&self) -> impl Iterator<Item = (&str, &str)> + '_
pub fn get_legacy_udas(&self) -> impl Iterator<Item = (&str, &str)> + '_
Like get_udas
, but returning each UDA key as a single string.
sourcepub fn get_modified(&self) -> Option<DateTime<Utc>>
pub fn get_modified(&self) -> Option<DateTime<Utc>>
Get the modification time for this task.
sourcepub fn get_dependencies(&self) -> impl Iterator<Item = Uuid> + '_
pub fn get_dependencies(&self) -> impl Iterator<Item = Uuid> + '_
Get the UUIDs of tasks on which this task depends.
This includes all dependencies, regardless of their status. In fact, it may include dependencies that do not exist.