pub struct ParsedTask {Show 13 fields
pub title: String,
pub status: TaskStatus,
pub created_at: DateTimeValue,
pub updated_at: DateTimeValue,
pub completed_at: Option<DateTimeValue>,
pub due: Option<DateTimeValue>,
pub scheduled: Option<NaiveDate>,
pub defer_until: Option<NaiveDate>,
pub project: Option<FileReference>,
pub area: Option<FileReference>,
pub body: String,
pub extra: HashMap<String, Value>,
pub projects_count: Option<usize>,
}Expand description
Parsed task content without a file path.
Use this when parsing from a string rather than reading from disk.
Fields§
§title: StringThe task title.
status: TaskStatusCurrent status of the task.
created_at: DateTimeValueWhen the task was created.
updated_at: DateTimeValueWhen the task was last updated.
completed_at: Option<DateTimeValue>When the task was completed.
due: Option<DateTimeValue>When the task is due.
scheduled: Option<NaiveDate>Date the task is scheduled to be worked on.
defer_until: Option<NaiveDate>Date until which the task is deferred.
project: Option<FileReference>Reference to the project this task belongs to.
area: Option<FileReference>Reference to the area this task belongs to.
body: StringMarkdown body.
extra: HashMap<String, Value>Unknown frontmatter fields.
projects_count: Option<usize>Number of elements in the projects array (if used).
Implementations§
Source§impl ParsedTask
impl ParsedTask
Sourcepub fn parse(content: &str) -> Result<Self, Error>
pub fn parse(content: &str) -> Result<Self, Error>
Parse task content from a string.
This extracts frontmatter using gray_matter and parses known fields.
Unknown fields are preserved in the extra map.
§Errors
Returns Error::ContentParse if the content cannot be parsed.
Returns Error::ContentMissingField if required fields are absent.
Returns Error::ContentInvalidField if a field has an invalid value.
Source§impl ParsedTask
impl ParsedTask
Sourcepub fn with_path(self, path: impl Into<PathBuf>) -> Task
pub fn with_path(self, path: impl Into<PathBuf>) -> Task
Convert to a Task by associating with a file path.
Sourcepub fn validate(&self) -> Vec<ValidationWarning>
pub fn validate(&self) -> Vec<ValidationWarning>
Validate the parsed task against spec recommendations.
Returns a list of warnings for spec violations. An empty list means the task fully complies with the specification.
Checks performed:
projectsarray should have exactly one element (warns if >1)- Completed tasks (done/dropped) should have
completed-atset
Trait Implementations§
Source§impl Clone for ParsedTask
impl Clone for ParsedTask
Source§fn clone(&self) -> ParsedTask
fn clone(&self) -> ParsedTask
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParsedTask
impl Debug for ParsedTask
Source§impl Display for ParsedTask
impl Display for ParsedTask
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Serialize to file content (frontmatter + body).
The output is a valid markdown file with YAML frontmatter.
Field order is consistent and deterministic.
Unknown fields from extra are preserved.
The projects_count field is NOT serialized (validation metadata only).
Source§impl PartialEq for ParsedTask
impl PartialEq for ParsedTask
impl StructuralPartialEq for ParsedTask
Auto Trait Implementations§
impl Freeze for ParsedTask
impl RefUnwindSafe for ParsedTask
impl Send for ParsedTask
impl Sync for ParsedTask
impl Unpin for ParsedTask
impl UnwindSafe for ParsedTask
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
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>
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>
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