[][src]Struct punch_clock::sheet::Sheet

pub struct Sheet {
    pub events: Vec<Event>,
}

List of events, together comprising a log of work from which totals can be calculated for various periods of time.

Fields

events: Vec<Event>

Methods

impl Sheet[src]

pub fn load_default() -> Result<Sheet, SheetError>[src]

Attempt to load a sheet from the file at the default location.

The default location is determined using the directories crate by platform as follows:

  • Linux: $XDG_CONFIG_HOME/punchclock/sheet.json
  • macOS: $HOME/Library/Application Support/dev.neros.PunchClock/sheet.json
  • Windows: %APPDATA%\Local\Neros\PunchClock\sheet.json

pub fn write_default(&self) -> Result<(), SheetError>[src]

Attempt to write a sheet to the file at the default location.

The default location is determined using the directories crate by platform as follows:

  • Linux: $XDG_CONFIG_HOME/punchclock/sheet.json
  • macOS: $HOME/Library/Application Support/dev.neros.PunchClock/sheet.json
  • Windows: %APPDATA%\Local\Neros\PunchClock\sheet.json

pub fn punch_in(&mut self) -> Result<DateTime<Utc>, SheetError>[src]

Record a punch-in (start of a time-tracking period) at the current time.

pub fn punch_in_at(
    &mut self,
    time: DateTime<Utc>
) -> Result<DateTime<Utc>, SheetError>
[src]

Record a punch-in (start of a time-tracking period) at the given time.

pub fn punch_out(&mut self) -> Result<DateTime<Utc>, SheetError>[src]

Record a punch-out (end of a time-tracking period) at the current time.

pub fn punch_out_at(
    &mut self,
    time: DateTime<Utc>
) -> Result<DateTime<Utc>, SheetError>
[src]

Record a punch-out (end of a time-tracking period) at the given time.

pub fn status(&self) -> SheetStatus[src]

Get the current status of time-tracking, including the time at which the status last changed.

pub fn count_range(&self, begin: DateTime<Utc>, end: DateTime<Utc>) -> Duration[src]

Count the amount of time for which there was recorded work between the two given instants, including an ongoing time-tracking period if there is one.

Trait Implementations

impl Clone for Sheet[src]

impl Debug for Sheet[src]

impl Default for Sheet[src]

impl<'de> Deserialize<'de> for Sheet[src]

impl Eq for Sheet[src]

impl Ord for Sheet[src]

impl PartialEq<Sheet> for Sheet[src]

impl PartialOrd<Sheet> for Sheet[src]

impl Serialize for Sheet[src]

impl StructuralEq for Sheet[src]

impl StructuralPartialEq for Sheet[src]

Auto Trait Implementations

impl RefUnwindSafe for Sheet

impl Send for Sheet

impl Sync for Sheet

impl Unpin for Sheet

impl UnwindSafe for Sheet

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.