pub struct ChoresState {
pub date: String,
pub items: Vec<String>,
pub rotation: u64,
pub prompted_date: String,
pub ever_used_chores: bool,
}Expand description
The user’s chore list for the current local day, held in the scheduler
while it runs. Mirrors the screen_time pattern: a snapshot loaded at
boot, rolled over when the local day changes, and persisted on mutation.
rotation is a monotonically advancing cursor (not an index) so that
editing the list mid-day doesn’t reset which chore comes next; the
selector takes it modulo the list length.
Fields§
§date: String§items: Vec<String>§rotation: u64§prompted_date: StringLocal day the morning prompt last fired (see
ChoresSnapshot::prompted_date). != date means “not prompted yet
today”.
ever_used_chores: boolTrue once the user has ever saved a non-empty list. Persists across the
daily rollover (unlike items), so the morning prompt only nudges
people who actually use chores — see should_prompt_morning_chores.
Implementations§
Source§impl ChoresState
impl ChoresState
Sourcepub fn from_snapshot(snap: ChoresSnapshot, today: &str) -> Self
pub fn from_snapshot(snap: ChoresSnapshot, today: &str) -> Self
Build state from a persisted snapshot. A snapshot from a previous day is discarded — a chore post-it is a fresh thing each morning, so we never carry yesterday’s list into today.
Sourcepub fn to_snapshot(&self) -> ChoresSnapshot
pub fn to_snapshot(&self) -> ChoresSnapshot
Convert this state into the on-disk wire format. The inverse of
from_snapshot.
Trait Implementations§
Source§impl Clone for ChoresState
impl Clone for ChoresState
Source§fn clone(&self) -> ChoresState
fn clone(&self) -> ChoresState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChoresState
impl Debug for ChoresState
Source§impl Default for ChoresState
impl Default for ChoresState
Source§fn default() -> ChoresState
fn default() -> ChoresState
Auto Trait Implementations§
impl Freeze for ChoresState
impl RefUnwindSafe for ChoresState
impl Send for ChoresState
impl Sync for ChoresState
impl Unpin for ChoresState
impl UnsafeUnpin for ChoresState
impl UnwindSafe for ChoresState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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