ParsedTask

Struct ParsedTask 

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

The task title.

§status: TaskStatus

Current status of the task.

§created_at: DateTimeValue

When the task was created.

§updated_at: DateTimeValue

When 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: String

Markdown 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

Source

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

Source

pub fn with_path(self, path: impl Into<PathBuf>) -> Task

Convert to a Task by associating with a file path.

Source

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:

  • projects array should have exactly one element (warns if >1)
  • Completed tasks (done/dropped) should have completed-at set

Trait Implementations§

Source§

impl Clone for ParsedTask

Source§

fn clone(&self) -> ParsedTask

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ParsedTask

Source§

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

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

impl Display for ParsedTask

Source§

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

Source§

fn eq(&self, other: &ParsedTask) -> bool

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

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 StructuralPartialEq for ParsedTask

Auto Trait Implementations§

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

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.