pub struct Day { /* private fields */ }
Expand description
Type representing a day and all associated tasks
Implementations§
Source§impl<'a> Day
impl<'a> Day
Sourcepub fn new(stamp: &str) -> Result<Self>
pub fn new(stamp: &str) -> Result<Self>
Creates a Day
struct that collects the entries for the date specified by
the stamp
.
§Errors
- Return an
Error::MissingDate
if the string is empty. - Return an
InvalidDate
error if thestamp
is not formatted as ‘YYYY-MM-DD’.
Sourcepub fn duration_secs(&self) -> u64
pub fn duration_secs(&self) -> u64
Return the duration of the day in seconds
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
only if no entries or events have been added to the day.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns true
only the day is complete.
Sourcepub fn date_stamp(&self) -> String
pub fn date_stamp(&self) -> String
Return the date stamp for the day in ‘YYYY-MM-DD’ form.
Sourcepub fn projects(&self) -> impl Iterator<Item = &str>
pub fn projects(&self) -> impl Iterator<Item = &str>
Return an iterator over the project names for today
Sourcepub fn events(&self) -> impl Iterator<Item = &Entry>
pub fn events(&self) -> impl Iterator<Item = &Entry>
Return an iterator over the events for today.
Sourcepub fn add_entry(&mut self, entry: Entry) -> Result<()>
pub fn add_entry(&mut self, entry: Entry) -> Result<()>
Add an Entry
to the current Day
.
§Errors
- Return an
EntryOrder
error if the new entry is before the previous entry.
Sourcepub fn update_dur(&mut self, date_time: &DateTime) -> Result<()>
pub fn update_dur(&mut self, date_time: &DateTime) -> Result<()>
Update the duration of the most recent task
§Errors
- Return an
EntryOrder
error if the new entry is before the previous entry.
Sourcepub fn finish(&mut self) -> Result<()>
pub fn finish(&mut self) -> Result<()>
Update the duration of the most recent task
§Errors
- Return an
EntryOrder
error if the new entry is before the previous entry.
Sourcepub fn start_day(&mut self, entry: &Entry) -> Result<()>
pub fn start_day(&mut self, entry: &Entry) -> Result<()>
Start a day from previous day’s last entry.
§Errors
- Return an
EntryOrder
error if the new entry is before the previous entry.
Sourcepub fn start_task(&mut self, entry: &Entry)
pub fn start_task(&mut self, entry: &Entry)
Initialize a new task item in the day based on the Entry
object supplied in event
.
This method only starts a task if no previous matching task exists in the day.
Sourcepub fn detail_report(&'a self) -> DetailReport<'a>
pub fn detail_report(&'a self) -> DetailReport<'a>
Return a DetailReport
from the current Day
.
Sourcepub fn summary_report(&'a self) -> SummaryReport<'a>
pub fn summary_report(&'a self) -> SummaryReport<'a>
Return a SummaryReport
from the current Day
.
Sourcepub fn hours_report(&'a self) -> HoursReport<'a>
pub fn hours_report(&'a self) -> HoursReport<'a>
Return a HoursReport
from the current Day
.
Sourcepub fn event_report(&'a self, compact: bool) -> EventReport<'a>
pub fn event_report(&'a self, compact: bool) -> EventReport<'a>
Return a EventReport
from the current Day
.
Sourcepub fn daily_chart(&'a self) -> DailyChart<'a>
pub fn daily_chart(&'a self) -> DailyChart<'a>
Return a DailyChart
from the current Day
.
Sourcepub fn has_events(&self) -> bool
pub fn has_events(&self) -> bool
Return true
if the day contains one or more events.
Sourcepub fn filtered_by_project(&self, filter: &Regex) -> Self
pub fn filtered_by_project(&self, filter: &Regex) -> Self
Sourcepub fn project_percentages(&'a self) -> Percentages
pub fn project_percentages(&'a self) -> Percentages
Return a Vec
of tuples mapping project name to percentage of the overall
time this project took.
Sourcepub fn task_percentages(&self, proj: &str) -> Percentages
pub fn task_percentages(&self, proj: &str) -> Percentages
Return a Vec
of tuples mapping the task name and percentage of the
supplied project.