pub struct EncodedTime<S: Scale, F: TimeFormat> { /* private fields */ }Expand description
A typed external encoding of a Time<S> instant.
EncodedTime<S, F> carries two phantom type parameters:
S: Scale— the physical time axis (TT,TAI,UTC, …).F: TimeFormat— the encoding scheme (JD,MJD,J2000s,Unix,GPS).
The compiler therefore treats EncodedTime<TT, JD> and
EncodedTime<UTC, JD> as completely distinct, incompatible types even
though both carry a day-valued quantity internally.
Implementations§
Source§impl<S: Scale, F: TimeFormat> EncodedTime<S, F>
impl<S: Scale, F: TimeFormat> EncodedTime<S, F>
Sourcepub const fn from_raw_unchecked(raw: Quantity<F::Unit>) -> Self
pub const fn from_raw_unchecked(raw: Quantity<F::Unit>) -> Self
Construct from a raw typed quantity without checking for finiteness.
For use in const contexts. The caller must ensure raw is finite;
passing a non-finite value produces incorrect behaviour.
Source§impl<S: Scale> EncodedTime<S, JD>
impl<S: Scale> EncodedTime<S, JD>
Source§impl<S: Scale, F> EncodedTime<S, F>where
F: FormatForScale<S>,
impl<S: Scale, F> EncodedTime<S, F>where
F: FormatForScale<S>,
Sourcepub fn try_new(raw: Quantity<F::Unit>) -> Result<Self, ConversionError>
pub fn try_new(raw: Quantity<F::Unit>) -> Result<Self, ConversionError>
Construct a typed encoded instant from its raw quantity.
Sourcepub fn try_to_time(self) -> Result<Time<S>, ConversionError>
pub fn try_to_time(self) -> Result<Time<S>, ConversionError>
Convert this encoded instant to the canonical Time<S> model.
Snapshots the active time-data bundle at call time via
TimeContext::new. For reproducible pipelines, prefer
to_time_with with an explicit context.
Sourcepub fn to_time_with(self, ctx: &TimeContext) -> Result<Time<S>, ConversionError>
pub fn to_time_with(self, ctx: &TimeContext) -> Result<Time<S>, ConversionError>
Convert this encoded instant to the canonical Time<S> model using an explicit context.
Source§impl<S: Scale, F> EncodedTime<S, F>where
F: InfallibleFormatForScale<S>,
impl<S: Scale, F> EncodedTime<S, F>where
F: InfallibleFormatForScale<S>,
Sourcepub fn to<T>(self) -> T::Outputwhere
T: InfallibleConversionTarget<S>,
pub fn to<T>(self) -> T::Outputwhere
T: InfallibleConversionTarget<S>,
Unified infallible conversion to a target scale or encoded format.
Sourcepub fn try_to<T>(self) -> Result<T::Output, ConversionError>where
T: ConversionTarget<S>,
pub fn try_to<T>(self) -> Result<T::Output, ConversionError>where
T: ConversionTarget<S>,
Unified fallible conversion to a target scale or encoded format.
Source§impl<S: Scale, F> EncodedTime<S, F>where
F: FormatForScale<S>,
impl<S: Scale, F> EncodedTime<S, F>where
F: FormatForScale<S>,
Sourcepub fn to_with<T>(self, ctx: &TimeContext) -> Result<T::Output, ConversionError>where
T: ContextConversionTarget<S>,
pub fn to_with<T>(self, ctx: &TimeContext) -> Result<T::Output, ConversionError>where
T: ContextConversionTarget<S>,
Unified context-backed conversion to a target scale or encoded format.