pub struct EncodedTime<S: Scale, R: TimeRepresentation> { /* private fields */ }Expand description
A typed external representation of a Time<S> instant.
Implementations§
Source§impl<S: Scale, R: TimeRepresentation> EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> EncodedTime<S, R>
Sourcepub const fn new_unchecked(raw: Quantity<R::Unit>) -> Self
pub const fn new_unchecked(raw: Quantity<R::Unit>) -> Self
Construct from a raw quantity, bypassing the finite check.
Passing a non-finite value yields an instant whose behaviour is
unspecified. Prefer Self::try_new for user-supplied data; use this
only when the value is known to be finite (e.g. compile-time constants).
Source§impl<S: Scale, R> EncodedTime<S, R>where
R: RepresentationForScale<S>,
impl<S: Scale, R> EncodedTime<S, R>where
R: RepresentationForScale<S>,
Sourcepub fn try_new(raw: Quantity<R::Unit>) -> Result<Self, ConversionError>
pub fn try_new(raw: Quantity<R::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, R> EncodedTime<S, R>where
R: InfallibleRepresentationForScale<S>,
impl<S: Scale, R> EncodedTime<S, R>where
R: InfallibleRepresentationForScale<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, R> EncodedTime<S, R>where
R: RepresentationForScale<S>,
impl<S: Scale, R> EncodedTime<S, R>where
R: RepresentationForScale<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.
Source§impl<S: Scale, R> EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
impl<S: Scale, R> EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
Source§impl<S: CoordinateScale> EncodedTime<S, JD>
impl<S: CoordinateScale> EncodedTime<S, JD>
Sourcepub const JULIAN_YEAR: Day
pub const JULIAN_YEAR: Day
Length of a Julian year in days (365.25 d).
Sourcepub const JULIAN_CENTURY: Day
pub const JULIAN_CENTURY: Day
Length of a Julian century in days (36 525 d).
Sourcepub fn new(jd: f64) -> Self
pub fn new(jd: f64) -> Self
Construct from a raw Julian Day value without validation.
Prefer Self::try_new for untrusted input.
Sourcepub fn jd_value(self) -> f64
pub fn jd_value(self) -> f64
Raw Julian Day value as f64 (days since noon 1 January 4713 BC JD).
Sourcepub fn julian_centuries(self) -> f64
pub fn julian_centuries(self) -> f64
Julian centuries since J2000.0: T = (JD − 2 451 545.0) / 36 525.
Sourcepub fn julian_millennias(self) -> f64
pub fn julian_millennias(self) -> f64
Julian millennia since J2000.0: T = (JD − 2 451 545.0) / 365 250.
Source§impl EncodedTime<TT, JD>
impl EncodedTime<TT, JD>
Sourcepub const J2000: Self = J2000_TT
pub const J2000: Self = J2000_TT
J2000.0 epoch as a TT-scale Julian Date (JD(TT) = 2 451 545.0).
Sourcepub fn tt_to_tdb(self) -> JulianDate<TDB>
pub fn tt_to_tdb(self) -> JulianDate<TDB>
Convert this TT Julian Date to the TDB scale.
Uses the Fairhead-Bretagnon periodic correction stored in the scale conversion layer. The result is on the TDB coordinate time axis, still expressed as a Julian Date.
Sourcepub fn from_chrono(dt: DateTime<Utc>) -> Self
pub fn from_chrono(dt: DateTime<Utc>) -> Self
Build a TT Julian Date from a chrono::DateTime<Utc>.
Converts UTC → TAI → TT internally. Panics if the UTC time data is
unavailable for the supplied instant; use
Time::<UTC>::try_from_chrono for a fallible path.
Source§impl<S: CoordinateScale> EncodedTime<S, MJD>
impl<S: CoordinateScale> EncodedTime<S, MJD>
Source§impl EncodedTime<TT, MJD>
impl EncodedTime<TT, MJD>
Sourcepub fn from_chrono(dt: DateTime<Utc>) -> Self
pub fn from_chrono(dt: DateTime<Utc>) -> Self
Build a TT Modified Julian Date from a chrono::DateTime<Utc>.
Converts UTC → TAI → TT internally. Panics if UTC time data is
unavailable; use Time::<UTC>::try_from_chrono for a fallible path.
Trait Implementations§
Source§impl<S: Scale, R> Add<Quantity<Day>> for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
impl<S: Scale, R> Add<Quantity<Day>> for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
Source§impl<S: Scale, R> AddAssign<Quantity<Day>> for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
impl<S: Scale, R> AddAssign<Quantity<Day>> for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
Source§fn add_assign(&mut self, rhs: Day)
fn add_assign(&mut self, rhs: Day)
+= operation. Read moreSource§impl<S: Scale, R: TimeRepresentation> Clone for EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> Clone for EncodedTime<S, R>
Source§impl<S: Scale, R: TimeRepresentation> Debug for EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> Debug for EncodedTime<S, R>
Source§impl<S: Scale, R: TimeRepresentation> Display for EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> Display for EncodedTime<S, R>
Source§impl<S: CoordinateScale> From<EncodedTime<S, JD>> for ModifiedJulianDate<S>
impl<S: CoordinateScale> From<EncodedTime<S, JD>> for ModifiedJulianDate<S>
Source§fn from(jd: JulianDate<S>) -> Self
fn from(jd: JulianDate<S>) -> Self
Convert a Julian Date to a Modified Julian Date on the same scale.
Source§impl<S: CoordinateScale> From<EncodedTime<S, MJD>> for JulianDate<S>
impl<S: CoordinateScale> From<EncodedTime<S, MJD>> for JulianDate<S>
Source§fn from(mjd: ModifiedJulianDate<S>) -> Self
fn from(mjd: ModifiedJulianDate<S>) -> Self
Convert a Modified Julian Date to a Julian Date on the same scale.
Source§impl<S: Scale, R> From<EncodedTime<S, R>> for Time<S>where
R: InfallibleRepresentationForScale<S>,
impl<S: Scale, R> From<EncodedTime<S, R>> for Time<S>where
R: InfallibleRepresentationForScale<S>,
Source§fn from(value: EncodedTime<S, R>) -> Self
fn from(value: EncodedTime<S, R>) -> Self
Source§impl<S: Scale, R> From<Time<S>> for EncodedTime<S, R>where
R: InfallibleRepresentationForScale<S>,
impl<S: Scale, R> From<Time<S>> for EncodedTime<S, R>where
R: InfallibleRepresentationForScale<S>,
Source§impl<S: Scale, R: TimeRepresentation> LowerExp for EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> LowerExp for EncodedTime<S, R>
Source§impl<S: Scale, R: TimeRepresentation> PartialEq for EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> PartialEq for EncodedTime<S, R>
Source§impl<S: Scale, R: TimeRepresentation> PartialOrd for EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> PartialOrd for EncodedTime<S, R>
Source§impl<S: Scale, R> Sub<Quantity<Day>> for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
impl<S: Scale, R> Sub<Quantity<Day>> for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
Source§impl<S: Scale, R> Sub for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
b - a returns the signed offset in days: positive when b is later.
impl<S: Scale, R> Sub for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
b - a returns the signed offset in days: positive when b is later.
Source§impl<S: Scale, R> SubAssign<Quantity<Day>> for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
impl<S: Scale, R> SubAssign<Quantity<Day>> for EncodedTime<S, R>where
R: TimeRepresentation<Unit = Day>,
Source§fn sub_assign(&mut self, rhs: Day)
fn sub_assign(&mut self, rhs: Day)
-= operation. Read moreSource§impl<S: Scale, R: TimeRepresentation> UpperExp for EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> UpperExp for EncodedTime<S, R>
impl<S: Scale, R: TimeRepresentation> Copy for EncodedTime<S, R>
Auto Trait Implementations§
impl<S, R> Freeze for EncodedTime<S, R>
impl<S, R> RefUnwindSafe for EncodedTime<S, R>
impl<S, R> Send for EncodedTime<S, R>
impl<S, R> Sync for EncodedTime<S, R>
impl<S, R> Unpin for EncodedTime<S, R>
impl<S, R> UnsafeUnpin for EncodedTime<S, R>
impl<S, R> UnwindSafe for EncodedTime<S, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.