pub struct Day { /* private fields */ }Expand description
Type representing a day and all associated tasks
Implementations
sourceimpl<'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::MissingDateif the string is empty. - Return an
InvalidDateerror if thestampis 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_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
EntryOrdererror 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
EntryOrdererror 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
EntryOrdererror 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
EntryOrdererror 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) -> EventReport<'a>
pub fn event_report(&'a self) -> EventReport<'a>
Return a HoursReport 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 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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Day
impl Send for Day
impl Sync for Day
impl Unpin for Day
impl UnwindSafe for Day
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more