pub struct Sheet {
pub events: Vec<Event>,
}Expand description
List of events, together comprising a log of work from which totals can be calculated for various periods of time.
Fields§
§events: Vec<Event>Implementations§
Source§impl Sheet
impl Sheet
Sourcepub fn load_default() -> Result<Sheet, SheetError>
pub fn load_default() -> Result<Sheet, SheetError>
Attempt to load a sheet from the file at the default location, as determined by
default_loc().
Sourcepub fn load<P>(path: P) -> Result<Sheet, SheetError>
pub fn load<P>(path: P) -> Result<Sheet, SheetError>
Attempt to load a sheet from the file at the given path.
Sourcepub fn default_dir() -> Result<PathBuf, SheetError>
pub fn default_dir() -> Result<PathBuf, SheetError>
Get the default directory in which sheets are stored.
The directory 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
Sourcepub fn default_loc() -> Result<PathBuf, SheetError>
pub fn default_loc() -> Result<PathBuf, SheetError>
Get the path to the file the default sheet is stored in.
This is the file sheet.json inside the directory returned from
default_dir().
Sourcepub fn write_default(&self) -> Result<(), SheetError>
pub fn write_default(&self) -> Result<(), SheetError>
Attempt to write a sheet to the file at the default location, as determined by
default_loc().
Sourcepub fn write<P>(&self, path: P) -> Result<(), SheetError>
pub fn write<P>(&self, path: P) -> Result<(), SheetError>
Attempt to write a sheet to the file at the given path.
Sourcepub fn punch_in(&mut self) -> Result<DateTime<Utc>, SheetError>
pub fn punch_in(&mut self) -> Result<DateTime<Utc>, SheetError>
Record a punch-in (start of a time-tracking period) at the current time.
Sourcepub fn punch_in_at(
&mut self,
time: DateTime<Utc>,
) -> Result<DateTime<Utc>, SheetError>
pub fn punch_in_at( &mut self, time: DateTime<Utc>, ) -> Result<DateTime<Utc>, SheetError>
Record a punch-in (start of a time-tracking period) at the given time.
Sourcepub fn punch_out(&mut self) -> Result<DateTime<Utc>, SheetError>
pub fn punch_out(&mut self) -> Result<DateTime<Utc>, SheetError>
Record a punch-out (end of a time-tracking period) at the current time.
Sourcepub fn punch_out_at(
&mut self,
time: DateTime<Utc>,
) -> Result<DateTime<Utc>, SheetError>
pub fn punch_out_at( &mut self, time: DateTime<Utc>, ) -> Result<DateTime<Utc>, SheetError>
Record a punch-out (end of a time-tracking period) at the given time.
Sourcepub fn status(&self) -> SheetStatus
pub fn status(&self) -> SheetStatus
Get the current status of time-tracking, including the time at which the status last changed.