Struct Day

Source
pub struct Day { /* private fields */ }
Expand description

Type representing a day and all associated tasks

Implementations§

Source§

impl<'a> Day

Source

pub fn new(stamp: &str) -> Result<Self>

Creates a Day struct that collects the entries for the date specified by the stamp.

§Errors
Source

pub fn duration_secs(&self) -> u64

Return the duration of the day in seconds

Source

pub fn is_empty(&self) -> bool

Returns true only if no entries or events have been added to the day.

Source

pub fn is_complete(&self) -> bool

Returns true only the day is complete.

Source

pub fn date_stamp(&self) -> String

Return the date stamp for the day in ‘YYYY-MM-DD’ form.

Source

pub fn date(&self) -> Date

Return the date for the Day object in a Date.

Source

pub fn projects(&self) -> impl Iterator<Item = &str>

Return an iterator over the project names for today

Source

pub fn events(&self) -> impl Iterator<Item = &Entry>

Return an iterator over the events for today.

Source

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

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

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

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

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.

Source

pub fn detail_report(&'a self) -> DetailReport<'a>

Return a DetailReport from the current Day.

Source

pub fn summary_report(&'a self) -> SummaryReport<'a>

Return a SummaryReport from the current Day.

Source

pub fn hours_report(&'a self) -> HoursReport<'a>

Return a HoursReport from the current Day.

Source

pub fn event_report(&'a self, compact: bool) -> EventReport<'a>

Return a EventReport from the current Day.

Source

pub fn daily_chart(&'a self) -> DailyChart<'a>

Return a DailyChart from the current Day.

Source

pub fn has_tasks(&self) -> bool

Return true if the day contains one or more tasks.

Source

pub fn has_events(&self) -> bool

Return true if the day contains one or more events.

Source

pub fn filtered_by_project(&self, filter: &Regex) -> Self

Make a copy of the current Day object containing only the tasks associated with a supplied Regex.

Source

pub fn project_percentages(&'a self) -> Percentages

Return a Vec of tuples mapping project name to percentage of the overall time this project took.

Source

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§

Source§

impl Debug for Day

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Day

§

impl RefUnwindSafe for Day

§

impl Send for Day

§

impl Sync for Day

§

impl Unpin for Day

§

impl UnwindSafe for Day

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