pub struct Span { /* private fields */ }Expand description
A closed interval of durations: a magnitude that is known only to within a range.
Window is to Instant as Span is to Delta, and the pairing is
what lets Rule U’s propagation actually happen. Rule J.2 requires an anchor’s
uncertainty to reach every derived field, and an anchor is a window; the
elapsed time from an uncertain anchor to an uncertain instant is therefore not
a Delta but a Span, and typing it as one keeps the uncertainty from being
dropped on the way through.
Implementations§
Source§impl Span
impl Span
Sourcepub fn new(lo: Delta, hi: Delta) -> Result<Span>
pub fn new(lo: Delta, hi: Delta) -> Result<Span>
Construct from bounds. UCAL-E0022 if inverted.
Sourcepub fn uncertainty(&self) -> Delta
pub fn uncertainty(&self) -> Delta
How wide the uncertainty is.
Sourcepub fn checked_add(&self, other: &Span) -> Result<Span>
pub fn checked_add(&self, other: &Span) -> Result<Span>
Interval addition: lo with lo, hi with hi (Rule U).
Sourcepub fn checked_sub(&self, other: &Span) -> Result<(Span, bool)>
pub fn checked_sub(&self, other: &Span) -> Result<(Span, bool)>
Interval subtraction, [lo - other.hi, hi - other.lo].
The lower bound clamps at zero rather than failing: a magnitude is non-negative, and two overlapping spans genuinely admit a difference of zero. The clamp is reported so a caller can tell it happened.