pub struct MetaLocal {
pub version: u32,
pub notified: HashMap<String, i64>,
pub last_task_date: Option<String>,
pub cache: MetaCache,
}Expand description
Per-device transient state: notification history and cache. Gitignored — never committed.
Fields§
§version: u32§notified: HashMap<String, i64>epoch_ref → unix timestamp (seconds) when notification was last sent.
last_task_date: Option<String>“YYYY-MM-DD” of the last morning task briefing notification.
cache: MetaCacheImplementations§
Source§impl MetaLocal
impl MetaLocal
pub fn filename() -> &'static str
pub fn path(storage_dir: &Path) -> PathBuf
Sourcepub fn load(storage_dir: &Path) -> Self
pub fn load(storage_dir: &Path) -> Self
Load from storage_dir/.mps.local. Returns Default if absent or unparseable.
Sourcepub fn save(&self, storage_dir: &Path) -> Result<(), MpsError>
pub fn save(&self, storage_dir: &Path) -> Result<(), MpsError>
Atomically write to storage_dir/.mps.local (tmp + rename). Also ensures .mps.local is listed in storage_dir/.gitignore.
Sourcepub fn was_notified(&self, epoch_ref: &str, cooldown_secs: i64) -> bool
pub fn was_notified(&self, epoch_ref: &str, cooldown_secs: i64) -> bool
Returns true if epoch_ref was notified within the last cooldown_secs seconds.
Sourcepub fn mark_notified(&mut self, epoch_ref: &str)
pub fn mark_notified(&mut self, epoch_ref: &str)
Record that epoch_ref was notified right now.
Sourcepub fn task_briefing_done_today(&self) -> bool
pub fn task_briefing_done_today(&self) -> bool
Returns true if the task briefing has already been sent today.
Sourcepub fn mark_task_briefing(&mut self)
pub fn mark_task_briefing(&mut self)
Record that the task briefing was sent today.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MetaLocal
impl<'de> Deserialize<'de> for MetaLocal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MetaLocal
impl RefUnwindSafe for MetaLocal
impl Send for MetaLocal
impl Sync for MetaLocal
impl Unpin for MetaLocal
impl UnsafeUnpin for MetaLocal
impl UnwindSafe for MetaLocal
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