pub struct Stamped<T> { /* private fields */ }Expand description
A signal wrapper that stamps every write with the time it happened, so a reader can ask how old the value is.
The read-side half of write freshness. The monitor side already exists:
writes: [X observed beat] with a beat_timeout: reports a node that has
not written recently. Stamped gives the consumer the same fact at the
point of use — age, is_fresh,
read_fresh — for the case the monitor cannot cover:
a value that is still being written but must not be trusted past a
certain age. What neither can tell is whether a fresh value is valid;
a plausible-looking drift needs a consumer that understands the value.
Writes go through w, reads through r; there is
deliberately no Deref, so an unstamped write path does not exist. It
records the time and nothing else — compose Stamped<Counted<T>> when
the write count matters too. Costs one AtomicU32 and one AtomicBool
beside the wrapped value. The stamp is Instant ticks truncated to
u32, like the node heartbeat: ages are exact up to u32::MAX ticks.
Implementations§
Trait Implementations§
Source§impl<T: Observable> Observable for Stamped<T>
Available on crate feature coupling-observe only.
impl<T: Observable> Observable for Stamped<T>
coupling-observe only.