pub struct Entry { /* private fields */ }Expand description
A single time-tracked entry in a TaskPaper doing file.
Each entry has a start date, a tag-free title, tags, an optional note, the section it belongs to, and a unique 32-character hex ID.
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn new(
date: DateTime<Local>,
title: impl Into<String>,
tags: Tags,
note: Note,
section: impl Into<String>,
id: Option<impl Into<String>>,
) -> Self
pub fn new( date: DateTime<Local>, title: impl Into<String>, tags: Tags, note: Note, section: impl Into<String>, id: Option<impl Into<String>>, ) -> Self
Create a new entry with the given fields.
If id is None, a deterministic ID is generated from the entry content.
Sourcepub fn done_date(&self) -> Option<DateTime<Local>>
pub fn done_date(&self) -> Option<DateTime<Local>>
Return the parsed @done tag timestamp, if present and valid.
Sourcepub fn duration(&self) -> Option<Duration>
pub fn duration(&self) -> Option<Duration>
Return elapsed time since the start date.
For finished entries this returns None — use interval instead.
Sourcepub fn end_date(&self) -> Option<DateTime<Local>>
pub fn end_date(&self) -> Option<DateTime<Local>>
Return the end date: the @done tag timestamp if present, otherwise None.
Sourcepub fn full_title(&self) -> String
pub fn full_title(&self) -> String
Return the title with inline tags, matching the original entry format.
Sourcepub fn interval(&self) -> Option<Duration>
pub fn interval(&self) -> Option<Duration>
Return the time between the start date and the @done date.
Returns None if the entry is not finished or the done date cannot be parsed.
Sourcepub fn overlapping_time(&self, other: &Entry) -> bool
pub fn overlapping_time(&self, other: &Entry) -> bool
Check whether this entry’s time range overlaps with another entry’s.
Uses each entry’s start date and end date (from @done tag). If either
entry lacks an end date, the current time is used.
Sourcepub fn should_finish(&self, never_finish: &[String]) -> bool
pub fn should_finish(&self, never_finish: &[String]) -> bool
Check whether the entry should receive a @done tag.
Returns false if any pattern in never_finish matches this entry’s
tags (patterns starting with @) or section name.
Sourcepub fn should_time(&self, never_time: &[String]) -> bool
pub fn should_time(&self, never_time: &[String]) -> bool
Check whether the entry should receive a date on the @done tag.
Returns false if any pattern in never_time matches this entry’s
tags (patterns starting with @) or section name.
Return the tags.
Return a mutable reference to the tags.
Sourcepub fn unfinished(&self) -> bool
pub fn unfinished(&self) -> bool
Return whether the entry does not have a @done tag.