pub struct Entry { /* private fields */ }
Expand description
Representation of an entry in the log
Objects of this type represent individual lines in the timelog.txt
file.
Each Entry
has a date and time stamp, an optional project, and a task.
Implementations§
source§impl Entry
impl Entry
sourcepub fn task_breakdown(entry_text: &str) -> (Option<String>, Option<String>)
pub fn task_breakdown(entry_text: &str) -> (Option<String>, Option<String>)
Parse the entry line text into the task name and detail parts if they exist.
sourcepub fn is_stop_line(line: &str) -> bool
pub fn is_stop_line(line: &str) -> bool
Return true
if the supplied string looks like a stop line.
sourcepub fn datetime_from_line(line: &str) -> Option<&str>
pub fn datetime_from_line(line: &str) -> Option<&str>
Extract a date/time string from a task line
sourcepub fn date_from_line(line: &str) -> Option<&str>
pub fn date_from_line(line: &str) -> Option<&str>
Extract a date string from a task line
sourcepub fn extract_year(line: &str) -> Option<i32>
pub fn extract_year(line: &str) -> Option<i32>
Return the year for the supplied entry line, if any.
sourcepub fn is_comment_line(line: &str) -> bool
pub fn is_comment_line(line: &str) -> bool
Return true
if the supplied line is a comment.
source§impl Entry
impl Entry
sourcepub fn new(entry_text: &str, time: DateTime) -> Self
pub fn new(entry_text: &str, time: DateTime) -> Self
Create a new Entry
representing the supplied task at the supplied time.
sourcepub fn new_marked(entry_text: &str, time: DateTime, kind: EntryKind) -> Self
pub fn new_marked(entry_text: &str, time: DateTime, kind: EntryKind) -> Self
Create a new Entry
representing the supplied task at the supplied time and optional
mark.
sourcepub fn from_line(line: &str) -> Result<Self, EntryError>
pub fn from_line(line: &str) -> Result<Self, EntryError>
Create a new Entry
representing the entry from the supplied line.
This entry must be formatted as described in Format.md.
Errors
Return an EntryError
if the line is empty or formatted incorrectly.
source§impl Entry
impl Entry
source§impl Entry
impl Entry
sourcepub fn change_date_time(&self, date_time: DateTime) -> Self
pub fn change_date_time(&self, date_time: DateTime) -> Self
Return a new copy of the current Entry
with the date and time
reset the the supplied value.
sourcepub fn change_text(&self, task: &str) -> Self
pub fn change_text(&self, task: &str) -> Self
Return a new copy of the current Entry
with the date and time
reset the the supplied value.
sourcepub fn to_day_end(&self) -> Self
pub fn to_day_end(&self) -> Self
Return a new Entry
timestamped as the end of this date
Trait Implementations§
source§impl PartialEq<Entry> for Entry
impl PartialEq<Entry> for Entry
source§impl PartialOrd<Entry> for Entry
impl PartialOrd<Entry> for Entry
source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self and other values if one exists.
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more