pub struct Stated<P: Profile> { /* private fields */ }Expand description
An instant together with the precision at which it was stated.
Rule T requires comparison across unequal precision to use interval semantics
and to be able to return indeterminate. Carrying the precision alongside the
value makes that the easy path: Stated::try_compare cannot be reached
without confronting UCAL-E0023, whereas comparing two bare Instants that
came from truncated text would quietly compare their floors.
This is what crate::codec::parse returns, as a pair; the type exists so
the pair need not be carried by hand.
Implementations§
Source§impl<P: Profile> Stated<P>
impl<P: Profile> Stated<P>
Sourcepub fn new(value: Instant<P>, precision: Precision) -> Self
pub fn new(value: Instant<P>, precision: Precision) -> Self
Pair a value with its stated precision.
Sourcepub fn value(&self) -> &Instant<P>
pub fn value(&self) -> &Instant<P>
The value as stated — its floor at the stated precision, not a tick unless the precision says so.
Sourcepub fn compare(&self, other: &Self) -> Result<IntervalOrdering>
pub fn compare(&self, other: &Self) -> Result<IntervalOrdering>
Interval-aware comparison, which may be indeterminate.
Sourcepub fn try_compare(&self, other: &Self) -> Result<Ordering>
pub fn try_compare(&self, other: &Self) -> Result<Ordering>
Interval-aware comparison as a total order, or UCAL-E0023 when the
intervals overlap and the order is genuinely not determined.
Trait Implementations§
impl<P: Profile> Copy for Stated<P>
u512 only.