Struct taskchampion::TaskMut

source ·
pub struct TaskMut<'r> { /* private fields */ }
Expand description

A mutable task, with setter methods.

Most methods are simple setters and not further described. Calling a setter will update the referenced Replica, as well as the included Task, immediately.

The Task methods are available on TaskMut via Deref.

Implementations§

source§

impl<'r> TaskMut<'r>

source

pub fn into_immut(self) -> Task

Get the immutable version of this object, ending the exclusive reference to the Replica.

source

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.

source

pub fn set_description(&mut self, description: String) -> Result<(), Error>

source

pub fn set_priority(&mut self, priority: String) -> Result<(), Error>

source

pub fn set_entry(&mut self, entry: Option<DateTime<Utc>>) -> Result<(), Error>

source

pub fn set_wait(&mut self, wait: Option<DateTime<Utc>>) -> Result<(), Error>

source

pub fn set_modified(&mut self, modified: DateTime<Utc>) -> Result<(), Error>

source

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.

source

pub fn start(&mut self) -> Result<(), Error>

Start the task by creating “start”: “”, if the task is not already active.

source

pub fn stop(&mut self) -> Result<(), Error>

Stop the task by removing the start key

source

pub fn done(&mut self) -> Result<(), Error>

Mark this task as complete

source

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.

source

pub fn add_tag(&mut self, tag: &Tag) -> Result<(), Error>

Add a tag to this task. Does nothing if the tag is already present.

source

pub fn remove_tag(&mut self, tag: &Tag) -> Result<(), Error>

Remove a tag from this task. Does nothing if the tag is not present.

source

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.

source

pub fn remove_annotation(&mut self, entry: DateTime<Utc>) -> Result<(), Error>

Remove an annotation, based on its entry time.

source

pub fn set_due(&mut self, due: Option<DateTime<Utc>>) -> Result<(), Error>

source

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.

source

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.

source

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.

source

pub fn remove_legacy_uda(&mut self, key: impl Into<String>) -> Result<(), Error>

Remove a user-defined attribute (UDA), where the key is a legacy key.

source

pub fn add_dependency(&mut self, dep: Uuid) -> Result<(), Error>

Add a dependency.

source

pub fn remove_dependency(&mut self, dep: Uuid) -> Result<(), Error>

Remove a dependency.

Methods from Deref<Target = Task>§

source

pub fn get_uuid(&self) -> Uuid

source

pub fn get_taskmap(&self) -> &TaskMap

source

pub fn get_status(&self) -> Status

source

pub fn get_description(&self) -> &str

source

pub fn get_entry(&self) -> Option<DateTime<Utc>>

source

pub fn get_priority(&self) -> &str

source

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.

source

pub fn is_waiting(&self) -> bool

Determine whether this task is waiting now.

source

pub fn is_active(&self) -> bool

Determine whether this task is active – that is, that it has been started and not stopped.

source

pub fn is_blocked(&self) -> bool

Determine whether this task is blocked – that is, has at least one unresolved dependency.

source

pub fn is_blocking(&self) -> bool

Determine whether this task is blocking – that is, has at least one unresolved dependent.

source

pub fn has_tag(&self, tag: &Tag) -> bool

Check if this task has the given tag

source

pub fn get_tags(&self) -> impl Iterator<Item = Tag> + '_

Iterate over the task’s tags

source

pub fn get_annotations(&self) -> impl Iterator<Item = Annotation> + '_

Iterate over the task’s annotations, in arbitrary order.

source

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.

source

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).

source

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.

source

pub fn get_legacy_udas(&self) -> impl Iterator<Item = (&str, &str)> + '_

Like get_udas, but returning each UDA key as a single string.

source

pub fn get_modified(&self) -> Option<DateTime<Utc>>

Get the modification time for this task.

source

pub fn get_due(&self) -> Option<DateTime<Utc>>

Get the due time for this task.

source

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.

source

pub fn get_value<S: Into<String>>(&self, property: S) -> Option<&str>

Get task’s property value by name.

Trait Implementations§

source§

impl<'r> Deref for TaskMut<'r>

§

type Target = Task

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'r> Freeze for TaskMut<'r>

§

impl<'r> !RefUnwindSafe for TaskMut<'r>

§

impl<'r> !Send for TaskMut<'r>

§

impl<'r> !Sync for TaskMut<'r>

§

impl<'r> Unpin for TaskMut<'r>

§

impl<'r> !UnwindSafe for TaskMut<'r>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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

§

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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more