pub struct DoseReminders {
pub dose: BTreeMap<String, BTreeMap<String, Tried>>,
}Expand description
What each device did to remind each dose, by the dose’s key, then the device’s id.
Fields§
§dose: BTreeMap<String, BTreeMap<String, Tried>>Implementations§
Source§impl DoseReminders
impl DoseReminders
pub fn default_path() -> PathBuf
Sourcepub fn read(path: &Path) -> Result<DoseReminders, Unsound>
pub fn read(path: &Path) -> Result<DoseReminders, Unsound>
The entries as written, or why they cannot be trusted. Never empty in
place of a file that does not read, nor of one lost after it was
written here (health::witnessed): a device’s word that it sent a
notice would look never said.
Sourcepub fn update<T>(
path: &Path,
now: i64,
me: &str,
change: impl FnOnce(&mut DoseReminders) -> T,
) -> Result<T, Problem>
pub fn update<T>( path: &Path, now: i64, me: &str, change: impl FnOnce(&mut DoseReminders) -> T, ) -> Result<T, Problem>
The entries changed by change, one writer at a time, read again just
before, so that nothing written meanwhile is written over; me, this
device’s id: its own entries past KEPT_DAYS dropped.
Sourcefn save(&mut self, path: &Path, now: i64, me: &str) -> Result<(), String>
fn save(&mut self, path: &Path, now: i64, me: &str) -> Result<(), String>
Saved, this device’s own entries past KEPT_DAYS dropped, by its
clock (each device takes its own out, and the sharing carries that: a
clock days ahead would empty the others’ else, the sixth review’s L3,
R8); every device’s entries STALE_DAYS after their dose, counted not
by this clock alone but by the earlier of it and the newest dose the
other devices’ entries name, so that a clock a month ahead, here or on
one other device, takes no entry of today’s out (the ninth review’s P1).
Use update: it holds the lock.
Sourcepub fn forget(&mut self, gone: &[String]) -> bool
pub fn forget(&mut self, gone: &[String]) -> bool
The entries of devices that stopped sharing (their own entry says so),
taken out by any device that reads it: the one exception to “each its
own” but STALE_DAYS (the seventh review’s L5). A device only
forgotten here keeps them: forgetting is one device’s view, and its
entries may still be today’s for the others (the eighth review’s L6).
Whether any was.
Sourcepub fn holds_any(&self, devices: &[String]) -> bool
pub fn holds_any(&self, devices: &[String]) -> bool
Whether any entry of these devices is here.
Sourcepub fn of(&self, key: &str, device: &str) -> Option<Tried>
pub fn of(&self, key: &str, device: &str) -> Option<Tried>
device’s entry for the dose key, if it wrote one.
Sourcepub fn entry(&mut self, key: &str, device: &str) -> &mut Tried
pub fn entry(&mut self, key: &str, device: &str) -> &mut Tried
device’s entry for the dose key, made when missing.
Sourcepub fn shown(&self, key: &str) -> bool
pub fn shown(&self, key: &str) -> bool
Whether a device’s notice of the dose was shown, as far as read here.
Sourcepub fn maybe_elsewhere(&self, key: &str, me: &str) -> Option<i64>
pub fn maybe_elsewhere(&self, key: &str, me: &str) -> Option<i64>
When the latest notice of the dose another device than me sent went,
not known shown; none.
Sourcepub fn maybe_by(&self, key: &str, me: &str) -> Option<(String, i64)>
pub fn maybe_by(&self, key: &str, me: &str) -> Option<(String, i64)>
The device whose notice of the dose went latest, not known shown, other
than me, and when; none.
Sourcepub fn maybe_anywhere(&self, key: &str) -> Option<i64>
pub fn maybe_anywhere(&self, key: &str) -> Option<i64>
When a device’s notice of the dose went without being known shown: a reminder that may not have shown (its question on the past says so).
Trait Implementations§
Source§impl Clone for DoseReminders
impl Clone for DoseReminders
Source§fn clone(&self) -> DoseReminders
fn clone(&self) -> DoseReminders
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 DoseReminders
impl Debug for DoseReminders
Source§impl Default for DoseReminders
impl Default for DoseReminders
Source§fn default() -> DoseReminders
fn default() -> DoseReminders
Source§impl<'de> Deserialize<'de> for DoseReminders
impl<'de> Deserialize<'de> for DoseReminders
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>,
Source§impl PartialEq for DoseReminders
impl PartialEq for DoseReminders
Source§impl Serialize for DoseReminders
impl Serialize for DoseReminders
impl StructuralPartialEq for DoseReminders
Auto Trait Implementations§
impl Freeze for DoseReminders
impl RefUnwindSafe for DoseReminders
impl Send for DoseReminders
impl Sync for DoseReminders
impl Unpin for DoseReminders
impl UnsafeUnpin for DoseReminders
impl UnwindSafe for DoseReminders
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.