pub struct Task {
pub id: Uuid,
pub title: String,
pub description: Option<String>,
pub url: Option<String>,
pub priority: Priority,
pub completed: bool,
pub list_id: Uuid,
pub tag_ids: Vec<Uuid>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub completed_at: Option<DateTime<Utc>>,
pub due_date: Option<DateTime<Utc>>,
}Expand description
A task/todo item
Fields§
§id: UuidUnique identifier
title: StringTask title
description: Option<String>Optional description
url: Option<String>Optional URL (can be opened in browser)
priority: PriorityPriority level
completed: boolWhether the task is completed
list_id: UuidID of the list this task belongs to
tag_ids: Vec<Uuid>IDs of tags attached to this task
created_at: DateTime<Utc>Creation timestamp
updated_at: DateTime<Utc>Last update timestamp
completed_at: Option<DateTime<Utc>>Completion timestamp (if completed)
due_date: Option<DateTime<Utc>>Optional due date
Implementations§
Source§impl Task
impl Task
Sourcepub fn new(title: impl Into<String>, list_id: Uuid) -> Self
pub fn new(title: impl Into<String>, list_id: Uuid) -> Self
Create a new task with the given title
Sourcepub fn uncomplete(&mut self)
pub fn uncomplete(&mut self)
Mark the task as not completed
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the description
Sourcepub fn with_priority(self, priority: Priority) -> Self
pub fn with_priority(self, priority: Priority) -> Self
Set the priority
Sourcepub fn with_due_date(self, due_date: DateTime<Utc>) -> Self
pub fn with_due_date(self, due_date: DateTime<Utc>) -> Self
Set the due date
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more