pub enum Freshness {
Fresh,
Stale {
by: Duration,
},
Unbounded,
}Expand description
How old a value is, measured against its staleness bound (ridl §9).
Variants§
Fresh
Within the bound.
Stale
Older than the bound.
Unbounded
The value has no staleness bound: its member’s timing has no max, as
under @[1s..]. A signal with no @ annotation is not unbounded,
because it receives the default range (ridl §9.1).
Implementations§
Source§impl Freshness
impl Freshness
Sourcepub fn of(
envelope: &Envelope,
now: Timestamp,
timing: Option<Timing>,
) -> Freshness
pub fn of( envelope: &Envelope, now: Timestamp, timing: Option<Timing>, ) -> Freshness
The freshness of a value whose envelope is envelope, read at now,
against the max of its member’s timing (ridl §4, §9; frame
specification §8).
With stamp the envelope’s timestamp: Fresh while
now − stamp ≤ max, Stale { by: now − stamp − max } past it, and
Unbounded when timing is None or carries no max. min plays no
part. Under a strict period @Xms, max holds the period, so the
period is the bound. A stamp later than now gives a negative age,
which the formula makes Fresh. The age subtraction now − stamp
saturates at the ends of the i64 range instead of overflowing.
Pass the member’s timing as the descriptor holds it:
Freshness::of(&envelope, now, member.timing).