Skip to main content

Entry

Struct Entry 

Source
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

Source

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.

Source

pub fn date(&self) -> DateTime<Local>

Return the start date.

Source

pub fn done_date(&self) -> Option<DateTime<Local>>

Return the parsed @done tag timestamp, if present and valid.

Source

pub fn duration(&self) -> Option<Duration>

Return elapsed time since the start date.

For finished entries this returns None — use interval instead.

Source

pub fn end_date(&self) -> Option<DateTime<Local>>

Return the end date: the @done tag timestamp if present, otherwise None.

Source

pub fn finished(&self) -> bool

Return whether the entry has a @done tag.

Source

pub fn full_title(&self) -> String

Return the title with inline tags, matching the original entry format.

Source

pub fn id(&self) -> &str

Return the 32-character hex ID.

Source

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.

Source

pub fn note(&self) -> &Note

Return the note.

Source

pub fn note_mut(&mut self) -> &mut Note

Return a mutable reference to the note.

Source

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.

Source

pub fn section(&self) -> &str

Return the section name.

Source

pub fn set_date(&mut self, date: DateTime<Local>)

Set the start date.

Source

pub fn set_title(&mut self, title: impl Into<String>)

Set the title.

Source

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.

Source

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.

Source

pub fn tags(&self) -> &Tags

Return the tags.

Source

pub fn tags_mut(&mut self) -> &mut Tags

Return a mutable reference to the tags.

Source

pub fn title(&self) -> &str

Return the tag-free title.

Source

pub fn unfinished(&self) -> bool

Return whether the entry does not have a @done tag.

Trait Implementations§

Source§

impl Clone for Entry

Source§

fn clone(&self) -> Entry

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 Entry

Source§

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

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

impl Display for Entry

Source§

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

Format as a full title line: title @tag1 @tag2(val) <id>

Auto Trait Implementations§

§

impl Freeze for Entry

§

impl RefUnwindSafe for Entry

§

impl Send for Entry

§

impl Sync for Entry

§

impl Unpin for Entry

§

impl UnsafeUnpin for Entry

§

impl UnwindSafe for Entry

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