pub struct Storage { /* private fields */ }Implementations§
Source§impl Storage
impl Storage
pub fn new() -> Result<Self>
pub fn load(&self, date: &Date) -> Result<DayData>
pub fn save(&self, day_data: &DayData) -> Result<()>
Sourcepub fn get_file_modified_time(&self, date: &Date) -> Option<SystemTime>
pub fn get_file_modified_time(&self, date: &Date) -> Option<SystemTime>
Get the modification time of a day data file Returns None if the file doesn’t exist
Sourcepub fn save_active_timer(&self, timer: &TimerState) -> Result<()>
pub fn save_active_timer(&self, timer: &TimerState) -> Result<()>
Save an active timer to running_timer.json
Sourcepub fn load_active_timer(&self) -> Result<Option<TimerState>>
pub fn load_active_timer(&self) -> Result<Option<TimerState>>
Load the active timer from running_timer.json
Returns None if no timer file exists (no active timer)
Sourcepub fn clear_active_timer(&self) -> Result<()>
pub fn clear_active_timer(&self) -> Result<()>
Clear the active timer by deleting running_timer.json
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Storage
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnwindSafe for Storage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more