Skip to main content

Dt

Struct Dt 

Source
pub struct Dt { /* private fields */ }
Expand description

Dt, and the library, is in the process of being switched from the sec and subsec fields being related to the scale, TO the sec and subsec fields always being TAI Epoch 2000-01-01 noon. Much of the documentation is outdated and should be ignored.

Implementations§

Source§

impl Dt

Source

pub fn from_str_parse(s: &str, opts: &Option<ParseCfg>) -> Result<Dt, DtErr>

Source

pub fn str_to_attos(s: &str, opts: &Option<ParseCfg>) -> Option<i128>

Same parsing logic as Dt::from_str, but returns attoseconds since the library epoch: 2000-01-01 12:00:00 UTC (on the UTC scale).

Returns Some(attos) on success (negative for pre-2000 dates) or None on any parse error.

Source

pub fn str_to_ms(s: &str, opts: &Option<ParseCfg>) -> Option<i128>

Same parsing logic as Dt::from_str, but returns milliseconds since the library epoch: 2000-01-01 12:00:00 UTC (on the UTC scale).

Returns Some(millis) on success (negative for pre-2000 dates) or None on any parse error.

Source

pub fn str_to_unix_ms(s: &str, opts: &Option<ParseCfg>) -> Option<i128>

Same parsing logic as Dt::from_str, but returns milliseconds since the UNIX epoch: (1970-01-01 00:00:00 UTC).

Returns Some(millis) on success (negative for pre-2000 dates) or None on any parse error.

Source§

impl Dt

Source

pub fn from_duration_str(s: &str, lang: Lang) -> Result<Dt, DtErr>

Parses duration strings with three clean priority tiers:

  1. Strict ISO 8601
  2. Common natural-language formats
  3. Legacy bare number, supports decimals → fractional milliseconds

Returns a Dt.

Source

pub fn natural_to_iso(s: &str, lang: Lang) -> Result<String, DtErr>

Converts a natural language duration into an ISO duration.

Source§

impl Dt

Source

pub const fn to_model_as_epoch(self, drift: Drift) -> ClockModel

Creates a new custom time model using this exact instant as the reference epoch.

  • The supplied Drift defines the relativistic model for the timescale.
  • The returned ClockModel can be used to convert to or from the custom timescale.
Source§

impl Dt

Source

pub const fn to_drift_as_constant(self, rate: Dt, accel: Dt) -> Drift

Source

pub const fn to_drift_as_rate(self, constant: Dt, accel: Dt) -> Drift

Source

pub const fn to_drift_as_accel(self, constant: Dt, rate: Dt) -> Drift

Source§

impl Dt

Source

pub const fn add(self, span: Dt) -> Self

Source

pub const fn sub(self, span: Dt) -> Self

Source

pub const fn to_sec_f(&self) -> Real

Converts this Dt to a floating-point number of seconds since the reference epoch of its associated scale.

  • The conversion is lossy, as Real provides approximately 15.95 decimal digits of precision.
Source

pub const fn adjusted_advance(&mut self, elapsed: &Dt, spacetime: &Spacetime)

Advances this Dt by the given elapsed duration while applying the relativistic proper-time correction derived from the supplied Spacetime model.

This method is intended for simulation of remote clocks (e.g., Earth time as observed from a spacecraft). For the spacecraft’s own hardware proper-time clock, use the plain add method instead.

Source

pub const fn adjusted_advance_using_drift( &mut self, elapsed: &Dt, drift: &Drift, )

Advances this Dt by the given elapsed duration while applying the relativistic proper-time correction from a pre-computed Drift value.

This is an optimized variant of adjusted_advance for callers that already hold a Drift instance. It is intended for simulation of remote clocks; the spacecraft’s own hardware clock should use the plain add method.

Source

pub const fn to_diff_raw(&self, other: Self) -> Dt

Computes the signed duration between this Dt and another Dt.

Source

pub const fn to_diff_raw_f(&self, other: Self) -> Real

Computes the signed duration between this Dt and another Dt as a float.

Source

pub const fn add_1sec(&mut self)

Adds exactly 1 second to this time value using saturating arithmetic.

Source

pub const fn add_1min(&mut self)

Adds exactly 1 minute (60 seconds) to this time value using saturating arithmetic.

Source

pub const fn add_1hr(&mut self)

Adds exactly 1 hour (3600 seconds) to this time value using saturating arithmetic.

Source

pub const fn add_1ms(&mut self)

Adds exactly 1 millisecond to this time value.

This affects the subsecond component and may cause a carry into the seconds field.

Source

pub const fn add_1us(&mut self)

Adds exactly 1 microsecond to this time value.

This affects the subsecond component and may cause a carry into the seconds field.

Source

pub const fn add_1ns(&mut self)

Adds exactly 1 nanosecond to this time value.

This affects the subsecond component and may cause a carry into the seconds field.

Source

pub const fn add_sec(&mut self, n: i64)

Adds the specified number of seconds to this time value using saturating arithmetic.

Source

pub const fn add_min(&mut self, n: i64)

Adds the specified number of minutes to this time value using saturating arithmetic.

Source

pub const fn add_hr(&mut self, n: i64)

Adds the specified number of hours to this time value using saturating arithmetic.

Source

pub const fn add_ms(&mut self, n: i64)

Adds the specified number of milliseconds to this time value.

Handles carry into the seconds field using saturating logic.

Source

pub const fn add_us(&mut self, n: i64)

Adds the specified number of microseconds to this time value.

Handles carry into the seconds field using saturating logic.

Source

pub const fn add_ns(&mut self, n: i64)

Adds the specified number of nanoseconds to this time value.

Handles carry into the seconds field using saturating logic.

Source

pub const fn add_ps(&mut self, n: i64)

Adds the specified number of picoseconds to this time value.

Handles carry into the seconds field using saturating logic.

Source

pub const fn add_fs(&mut self, n: i64)

Adds the specified number of femtoseconds to this time value.

Handles carry into the seconds field using saturating logic.

Source

pub const fn add_attos(&mut self, n: i64)

Adds the specified number of attoseconds to this time value.

Handles carry into the seconds field using saturating logic.

Source

pub const fn sub_1hr(&mut self)

Subtracts exactly 1 hour (3600 seconds) from this time value using saturating arithmetic.

Source

pub const fn sub_1min(&mut self)

Subtracts exactly 1 minute (60 seconds) from this time value using saturating arithmetic.

Source

pub const fn sub_1sec(&mut self)

Subtracts exactly 1 second from this time value using saturating arithmetic.

Source

pub const fn sub_1ms(&mut self)

Subtracts exactly 1 millisecond from this time value.

This affects the subsecond component and may cause a borrow from the seconds field.

Source

pub const fn sub_1us(&mut self)

Subtracts exactly 1 microsecond from this time value.

This affects the subsecond component and may cause a borrow from the seconds field.

Source

pub const fn sub_1ns(&mut self)

Subtracts exactly 1 nanosecond from this time value.

This affects the subsecond component and may cause a borrow from the seconds field.

Source

pub const fn sub_sec(&mut self, n: i64)

Subtracts the specified number of seconds from this time value using saturating arithmetic.

Source

pub const fn sub_min(&mut self, n: i64)

Subtracts the specified number of minutes from this time value using saturating arithmetic.

Source

pub const fn sub_hr(&mut self, n: i64)

Subtracts the specified number of hours from this time value using saturating arithmetic.

Source

pub const fn sub_ms(&mut self, n: i64)

Subtracts the specified number of milliseconds from this time value.

Handles borrow from the seconds field using saturating logic.

Source

pub const fn sub_us(&mut self, n: i64)

Subtracts the specified number of microseconds from this time value.

Handles borrow from the seconds field using saturating logic.

Source

pub const fn sub_ns(&mut self, n: i64)

Subtracts the specified number of nanoseconds from this time value.

Handles borrow from the seconds field using saturating logic.

Source

pub const fn sub_ps(&mut self, n: i64)

Subtracts the specified number of picoseconds from this time value.

Handles borrow from the seconds field using saturating logic.

Source

pub const fn sub_fs(&mut self, n: i64)

Subtracts the specified number of femtoseconds from this time value.

Handles borrow from the seconds field using saturating logic.

Source

pub const fn sub_attos(&mut self, n: i64)

Subtracts the specified number of attoseconds from this time value.

Handles borrow from the seconds field using saturating logic.

Source

pub const fn to_attos(&self) -> i128

Total attoseconds (exact i128 representation within the representable range).

Source

pub const fn to_ms(&self) -> i128

Returns the total time in milliseconds.

Source

pub const fn to_us(&self) -> i128

Returns the total time in microseconds.

Source

pub const fn to_ns(&self) -> i128

Returns the total time in nanoseconds.

Source

pub const fn to_ps(&self) -> i128

Returns the total time in picoseconds.

Source

pub const fn to_fs(&self) -> i128

Returns the total time in femtoseconds.

Source

pub const fn is_zero(&self) -> bool

Returns true if this time is exactly zero.

Source

pub const fn is_positive(&self) -> bool

Returns true if this time is strictly positive > 0.

Source

pub const fn mul(self, rhs: i64) -> Self

Multiplies this time by an integer scalar (exact).

Uses 128-bit arithmetic internally.

Source

pub const fn div(self, rhs: i64) -> Self

Divides this Dt by an integer scalar.

Uses truncating division (rounds toward zero), same as normal integer division. Returns ZERO if rhs == 0.

Source

pub const fn floor(&self, unit: Self) -> Self

Returns the largest multiple of unit that is ≤ self. If unit is zero, returns self unchanged (exact, full precision).

Source

pub const fn ceil(&self, unit: Self) -> Self

Returns the smallest multiple of unit that is ≥ self. If unit is zero, returns self unchanged (exact, full precision).

Source

pub const fn round(&self, unit: Self) -> Self

Returns the nearest multiple of unit.

Halfway cases round away from zero (e.g. 2.5 → 3.0, -2.5 → -3.0), matching the behavior of the old f64::round().

  • If unit is zero, returns self unchanged (preserves full precision).
  • Uses Euclidean division internally for correct behavior on negative values.
  • The result is always a multiple of unit.
Source

pub const fn abs_div_floor(&self, unit: Self) -> usize

Returns floor(|self| / |unit|) as usize, saturating at usize::MAX.

Fully exact integer arithmetic using 128-bit intermediaries. Used by TimeRange::len.

Source

pub const fn mul_by_f(&self, rhs: Real) -> Self

  • Integer part of rhs is multiplied exactly (pure i128 arithmetic).
  • Fractional part (|frac| < 1) uses the 10¹⁵ scaling.
Source

pub const fn div_by_f(&self, rhs: Real) -> Self

Divides by a real number (routes through the high-precision mul_by_f).

Source

pub const fn div_by_2(&self) -> Self

Divides this Dt by 2 (convenience wrapper).

Source

pub const fn to_sec(&mut self) -> i64

Returns the total time in seconds.

Source§

impl Dt

Source

pub const ZERO: Self

The library’s internal reference epoch: exactly 2000-01-01 12:00:00 TAI.

[Dt::new(0, 0)].

Source

pub const UNIX_EPOCH: Self

UNIX epoch.

  • 1970-01-01 midnight TAI.
  • Stored here on the TAI timescale as an offset from Self::ZERO.
  • -946_728_000 sec
  • 0 attos
  • The library’s epoch for time scales during conversions is 2000-01-01 noon. This const is provided as a convenience.
Source

pub const TAI_1977_EPOCH: Self

TT/TCG/TCB/TDB epoch.

  • 1977-01-01 midnight TAI.
  • Stored here on the TAI timescale as an offset from Self::ZERO.
  • -725_803_200 sec
  • 0 attos
  • The library’s epoch for time scales during conversions is 2000-01-01 noon. This const is provided as a convenience.
Source

pub const TCL_1977_EPOCH: Self

TT/TCG/TCB/TDB/TCL epoch.

  • 1977-01-01 midnight TAI.
  • Stored here on the TCL timescale as an offset from Self::ZERO.
  • The library’s epoch for time scales during conversions is 2000-01-01 noon. This const is provided as a convenience.
Source

pub const CXC_EPOCH: Self

Chandra X-ray Center (CXC) Time epoch.

  • 1998-01-01 midnight TT.
  • Stored here on the TAI timescale as an offset from Self::ZERO.
  • -63_115_233 sec
  • 816000000000000000 attos
  • The library’s epoch for time scales during conversions is 2000-01-01 noon. This const is provided as a convenience.
Source

pub const GPS_EPOCH: Self

GPS/Galileo Experiment (GALEX) Time epoch.

  • 1980-01-06 00:00:00 UTC.
  • Stored here on the TAI timescale as an offset from Self::ZERO.
  • -630_763_200 + 19 sec
  • 0 attos
  • The library’s epoch for time scales during conversions is 2000-01-01 noon. This const is provided as a convenience.
Source

pub const GALILEO_EPOCH: Self

Galileo System Time (GST) epoch.

  • 1999-08-22 00:00:00 GST.
  • Stored here on the TAI timescale as an offset from Self::ZERO.
  • -11_448_000 + 19 sec
  • 0 attos
  • The library’s epoch for time scales during conversions is 2000-01-01 noon. This const is provided as a convenience.
Source

pub const BDT_EPOCH: Self

BeiDou Time (BDT) epoch.

  • 2006-01-01 00:00:00 UTC.
  • Stored here on the TAI timescale as an offset from Self::ZERO.
  • 189_345_600 + 33 sec
  • 0 attos
  • The library’s epoch for time scales during conversions is 2000-01-01 noon. This const is provided as a convenience.
Source

pub const MAX: Self

Maximum representable duration (i64::MAX seconds + 999… attoseconds).

Source

pub const MIN: Self

Minimum (most negative) representable duration (i64::MIN seconds).

Source

pub const SEC_19: Self

Source

pub const SEC_33: Self

Source

pub const SEC_37: Self

Source

pub const ONE_DAY: Self

Source

pub const fn new(sec: i64, attos: u64) -> Self

Creates a new Dt from whole seconds, a subsecond part in attoseconds, and a scale, automatically normalizing the representation.

Source

pub const fn from_attos(attos: i128, scale: Scale) -> Self

Source

pub const fn from_sec(sec: i64, scale: Scale) -> Self

Source

pub const fn from_ms(ms: i128, scale: Scale) -> Self

Source

pub const fn from_us(us: i128, scale: Scale) -> Self

Source

pub const fn from_ns(ns: i128, scale: Scale) -> Self

Source

pub const fn from_ps(ps: i128, scale: Scale) -> Self

Source

pub const fn from_fs(fs: i128, scale: Scale) -> Self

Source

pub const fn from_min(m: i64, scale: Scale) -> Self

Source

pub const fn from_hr(h: i64, scale: Scale) -> Self

Source

pub const fn from_hms( hr: i64, min: i64, sec: i64, ms: i128, us: i128, ns: i128, scale: Scale, ) -> Self

Creates a Dt from hours, minutes, seconds, milliseconds, microseconds, and nanoseconds on the supplied scale.

Source

pub const fn from_days(d: i64, scale: Scale) -> Dt

Source

pub const fn wk(wk: i64, scale: Scale) -> Dt

Source

pub const fn yr(yr: i64, scale: Scale) -> Dt

Source

pub const fn ago(self, scale: Scale) -> Dt

Returns a Dt that is this duration ago from the given scale.

Source

pub const fn from_now(self, scale: Scale) -> Dt

Returns a Dt that is this duration from now in the given scale.

Source

pub const fn neg(self) -> Self

Returns the negation of this duration.

Source

pub const fn abs(self) -> Self

Returns the positive of this duration.

Source

pub const fn from_sec_f(sec_f: Real) -> Self

Creates a Dt from a floating-point number of seconds.

Source

pub const fn sec_f_to_total_attos(sec_f: f64) -> i128

High-precision conversion from f64 seconds to total attoseconds (i128). Uses IEEE 754 bit extraction + exact integer multiplication by 5^18.

Source

pub const fn from_sec_f_on(sec_f: Real, s: Scale) -> Dt

Creates a Dt from a floating-point number of seconds.

  • Assumes the value is on the given scale.
  • Converts the values to TAI, the returned Dt is on the TAI time scale.
Source

pub fn now() -> Result<Self, DtErr>

Returns the current system time as TAI from 2000-01-01 noon.

This method is only available when the std feature is enabled and the target is not WASM with the js feature.

Source§

impl Dt

Source

pub const fn from_dt(dt: Dt, scale: Scale) -> Dt

Source

pub const fn from_attos_since(attos: i128, reference: Dt) -> Self

Source

pub const fn to_scale_and_then_diff(&self, scale: Scale, epoch: Dt) -> Dt

Source

pub const fn from_diff_and_scale(diff: Dt, epoch: Dt, current: Scale) -> Self

Source

pub const fn from(sec: i64, attos: u64, scale: Scale) -> Dt

Creates a TAI Dt.

  • Assumes the given sec and attos are on the given scale.
  • Equivalent to e.g. TT sec and attos -> TAI Dt.

See Scale for more information on available time scales.

Source

pub const fn to_tai(&self, current: Scale) -> Dt

Source

pub const fn to(&self, current: Scale, target: Scale) -> Dt

Source

pub const fn convert_using_drift(self, reference: Self, drift: Drift) -> Self

Converts this instant to any other Scale while applying an exact quadratic relativistic or clock-drift correction defined by a Drift model relative to a reference instant.

Source

pub const fn convert_back_using_drift( self, reference: Self, drift: Drift, ) -> Self

Performs the inverse conversion of Self::convert_using_drift, recovering the original proper time on the source clock scale.

A fixed-point iteration (at most 16 steps) is used to solve the implicit equation. For the common case of a pure constant offset the function returns immediately without iteration.

Source

pub const fn convert_using_model(self, model: ClockModel) -> Self

Converts this instant using a self-describing ClockModel.

Source

pub const fn convert_back_using_model(self, model: ClockModel) -> Self

Performs the inverse conversion of Self::convert_using_model.

Source§

impl Dt

Source

pub const fn to_jyear(&self) -> Real

Returns the Julian epoch year.

Source

pub const fn from_jyear(jyear: Real, scale: Scale) -> Self

Inverse of Self::to_jyear.

Source

pub const fn to_byear(&self) -> Real

Returns the Besselian epoch year.

Source

pub const fn from_byear(byear: Real, scale: Scale) -> Self

Inverse of Self::to_byear.

Source

pub const fn to_decimalyear(&self, current: Scale) -> Real

Returns the decimal year (Gregorian calendar year + fraction of the year).

This is the direct equivalent of Astropy’s Time.decimalyear:

  • Uses the actual length of the specific Gregorian year (365 or 366 days, plus any leap seconds on UTC/UTCSpice/etc.).
  • Fully scale-aware (TAI, TT, UTC, TDB, custom clocks, …).
  • Exact integer arithmetic for the year boundaries, then a high-precision to_sec_f division (lossy only at the final Real step, same as Astropy).
Source§

impl Dt

Source

pub fn from_ccsds_str(input: &str) -> Result<Self, DtErr>

Generalized CCSDS ASCII Time Code parser (A or B variant). Handles both calendar (%Y-%m-%d) and day-of-year (%Y-%j) formats. All time components after the date portion are optional.

Source

pub fn from_ccsds_ccs(input: &[u8]) -> Result<Dt, DtErr>

Parses a CCSDS CCS (Calendar Segmented Time Code) binary time code directly into TimeParts.

Implements CCSDS 301.0-B-4 §3.4 (Level 1 only).

§P-field (exactly 1 byte)
  • Bit 7: Extension flag → must be 0 (we reject extensions)
  • Bits 6-4: Code ID = 101
  • Bit 3: Calendar type (0 = Month/Day, 1 = Day-of-Year)
  • Bits 2-0: Number of subsecond BCD octets (06)
§T-field (BCD, big-endian)
  • 2 bytes: Year (0001–9999)
  • 2 bytes: Month+Day (01-12,01-31) or Day-of-Year (001–366)
  • 3 bytes: Hour (00-23), Minute (00-59), Second (00-60)
  • 0–6 bytes: Fractional seconds (exactly 2 decimal digits per byte)

Epoch: 1958-01-01 00:00:00 UTC (identical to CDS).

Source

pub fn from_ccsds_c(input: &[u8]) -> Result<Dt, DtErr>

Parses a CCSDS C (CUC – Unsegmented Time Code) binary time code directly into Dt.

This function implements CCSDS 301.0-B-4 §3.2 (Level 1 only) with full support for the extended P-field (second octet) as defined in the standard.

§Supported formats (Level 1 only)
  • 1-byte or 2-byte P-field (further extension beyond 2 bytes is rejected).
  • Code ID must be 001 (1958-01-01 TAI epoch).
  • Coarse time: 1–7 octets (base 1–4 from Octet 1 + up to 3 additional from Octet 2).
  • Fractional time: 0–10 octets (base 0–3 from Octet 1 + up to 7 additional from Octet 2).
§P-field decoding (when Bit 0 of Octet 1 = 1)
  • Octet 2:
    • Bit 0: Further-extension flag (must be 0; we reject 3+-byte P-fields).
    • Bits 1-2: Additional coarse octets (0–3).
    • Bits 3-5: Additional fractional octets (0–7).
    • Bits 6-7: Reserved for mission definition (ignored).
§Precision

Fractional seconds are converted to attoseconds with exact integer scaling (value / 2^(8·n_frac)). Larger n_frac gives higher resolution (down to ~2⁻⁸⁰ s with 10 fractional bytes).

§Returns

A Dt with scale = TAI and tz = Utc.

§Errors
  • [DtErrKind::CCSDSBinEmpty] if the input is empty.
  • [DtErrKind::CCSDSBinTooShort] if the input is too short for the declared P-field / T-field sizes or otherwise malformed.
  • [DtErrKind::CCSDSBinInvalidCodeId] if the Code ID is not 001.
  • [DtErrKind::CCSDSBinInvalidPFieldExtension] if the further-extension flag is set (3+ byte P-field, unsupported).
Source

pub fn from_ccsds_d(input: &[u8]) -> Result<Dt, DtErr>

Parses a CCSDS D (CDS – Day Segmented Time Code) binary time code directly into Dt.

This function implements CCSDS 301.0-B-4 §3.3 (Level 1 only).

§Supported formats
  • 1-byte or 2-byte P-field.
  • Code ID must be 100 and Epoch bit must be 0 (1958-01-01 UTC epoch).
  • n_day: 2 or 3 bytes for the day count.
  • Middle field is always 4 bytes of milliseconds since midnight.
  • Sub-millisecond field (bits 6-7 of P-field):
    • 00: no fractional field
    • 01: 2 bytes (microseconds of the millisecond, 0–65535)
    • 10: 4 bytes (2⁻³² of the millisecond)
§Precision
  • The millisecond field is rounded to the nearest millisecond (in the encoder).
  • With 2-byte sub-ms: maximum quantization error ≈ ±7.63 ns.
  • With 4-byte sub-ms: maximum quantization error ≈ ±0.116 ps.
§Returns

A Dt with timescale = Utc and tz = Utc.

§Errors
  • [DtErrKind::CCSDSBinEmpty] if the input is empty.
  • [DtErrKind::CCSDSBinTooShort] if the input is too short for the declared field sizes.
  • [DtErrKind::CCSDSBinInvalidCodeId] if the Code ID is not 100.
  • [DtErrKind::CCSDSBinInvalidEpoch] if the Epoch bit is set (non-Level-1 / non-1958 epoch).
  • [DtErrKind::CCSDSBinInvalidSubMillisecondCode] if bits 6-7 encode an unsupported value (0b11).
Source

pub fn from_ccsds_bin(input: &[u8]) -> Result<Dt, DtErr>

Auto-detects and parses a CCSDS binary time code (CUC, CDS, or CCS) based on the Code ID in the first P-field byte.

Convenience wrapper around TimeParts::from_ccsds_bin.

§Supported formats
  • Code ID 001 → CUC (Unsegmented)
  • Code ID 100 → CDS (Day Segmented)
  • Code ID 101 → CCS (Calendar Segmented)
§Errors
  • [DtErrKind::CCSDSBinEmpty] if the input is empty.
  • [DtErrKind::CCSDSBinInvalidCodeId] for any other Code ID.
Source§

impl Dt

Source

pub const fn from_gps_wk_and_tow(wk: i64, tow: Dt) -> Self

Creates a Dt in GPS Time (GPS) from a GPS week number and Time of Week (TOW).

This is the exact inverse of [Self::to_gps_week_and_tow].

  • week: Full GPS week number (can be negative for dates before 1980).
  • tow: Time of Week as a Dt. Values ≥ 604800 seconds are automatically carried into the week number.

The resulting Dt is always in Scale::GPS.

Source

pub const fn from_gps_wk_and_tow_f(week: i64, tow: Real) -> Self

Creates a Dt in GPS Time from a GPS week number and floating-point Time of Week.

This is the floating-point counterpart to Self::from_gps_wk_and_tow.

Source

pub const fn from_gps(elapsed: Dt) -> Self

Inverse of Self::to_gps.

Source

pub const fn from_gps_f(elapsed_sec: Real) -> Self

Floating-point version of Self::from_gps.

Source

pub const fn from_cxcsec(elapsed: Dt) -> Self

Inverse of Self::to_cxcsec.

Source

pub const fn from_cxcsec_f(elapsed_sec: Real) -> Self

Floating-point counterpart of Self::from_cxcsec.

Source

pub const fn from_galexsec(elapsed: Dt) -> Self

Inverse of Self::to_galexsec.

Source

pub const fn from_galexsec_f(elapsed_sec: Real) -> Self

Floating-point counterpart of Self::from_galexsec.

Source§

impl Dt

Source

pub fn from_str( s: &str, fmt: &str, inp_can_end_before_fmt: bool, fmt_can_end_before_inp: bool, allow_partial_date: bool, ) -> Result<Dt, DtErr>

Source

pub fn parse_fmt(strptime_fmt: &str) -> Result<StrPTimeFmt, DtErr>

Source

pub fn from_iso_duration(s: &str) -> Result<Dt, DtErr>

Source

pub fn looks_like_iso(s: &str) -> bool

Accepts: P1Y, -P2W, PT1.5H, P1DT2H30M, +P3D, p1y, P1,5S, PT0S, etc. Rejects: anything with whitespace, lone “P”/“-P”/“PT”, “P123”, “Please wait 5m”, “1.5h”, “P1Yabc”, “P1Y!”, or any string longer than 128 bytes.

Source§

impl Dt

Source

pub const fn to_unix(&self, current: Scale, target: Scale) -> Dt

Returns this Dt but as a unix timestamp where the:

  • .sec field is seconds since the UNIX epoch (1970-01-01 00:00:00).
  • .attos field is remaining fractional seconds.
§Notes:
  • Assumes this Dt is from the 2000-01-01 noon epoch.
Source

pub const fn unix_sec_to_ymd(unix_sec: i64) -> (i64, u8, u8)

Converts a Unix timestamp (seconds since 1970-01-01 00:00:00 UTC) to a proleptic Gregorian date (year, month, day).

Source

pub const fn to_gregorian_time(&self, current: Scale) -> GregorianTime

Source

pub const fn to_ymdhms(&self, current: Scale) -> YmdHms

Returns the Gregorian date and wall time for this instant.

  • For Scale::UTC: Uses a direct Unix-timestamp-based path (fast and clean).
  • For all other scales: Uses the standard TT-based JD path.
Source

pub const fn ymdhms_to_unix_sec( yr: i64, mo: u8, day: u8, hr: u8, min: u8, sec: u8, ) -> i64

Converts a proleptic Gregorian calendar date+time to a Unix timestamp (seconds since 1970-01-01 00:00:00 UTC).

This version is correct for the full i64 range, including negative years.

Source

pub const fn jdn_to_ymd(jdn: i64) -> (i64, u8, u8)

Converts a Julian Day Number (JDN) to a proleptic Gregorian calendar date.

Returns (year, month, day) where month ∈ [1, 12] and day ∈ [1, 31] (standard 1-based Gregorian values).

This is the inverse of Self::ymd_to_jdn. Supports the full i64 range, including negative years and year zero.

Source

pub const fn ymd_to_jdn(year: i64, month: u8, day: u8) -> i64

Computes the Julian Day Number (JDN) for a proleptic Gregorian calendar date at noon UT.

§Arguments
  • year - Year (any i64; proleptic Gregorian)
  • month - Month (1-based: 1 = January, 2 = February, …, 12 = December)
  • day - Day of the month (1-based: 1 = first day of the month)

The algorithm matches the standard astronomical convention used throughout the library (ymd_to_jdn(2000, 1, 1) == 2451545).

This is the inverse of [jdn_to_ymd].

§Notes
  • This function assumes a valid date. Passing month = 0 or day = 0 (or other out-of-range values) will produce incorrect results.
  • The result is the integer JDN corresponding to noon UT on the given date.
Source

pub const fn is_leap_year(year: i64) -> bool

Returns true if the given year is a Gregorian leap year under proleptic rules.

Source

pub const fn from_ymdhms( yr: i64, mo: u8, day: u8, hr: u8, min: u8, sec: u8, attos: u64, ) -> Self

Creates a Dt at the specified civil UTC instant with full attosecond precision on the proleptic Gregorian calendar, then converts it to the requested Scale.

All input components are clamped to their valid ranges:

  • mo → 0..=12
  • day → 0..=31
  • hr → 0..=23
  • min → 0..=59
  • sec → 0..=60 (permits leap seconds)
  • attos → values ≥ 10¹⁸ are carried into the seconds field
Source

pub const fn from_ymdhms_on( yr: i64, mo: u8, day: u8, hr: u8, min: u8, sec: u8, attos: u64, scale: Scale, ) -> Self

Source

pub const fn from_ymd(yr: i64, mo: u8, day: u8) -> Self

Creates a Dt representing midnight 00:00:00 UTC on the given proleptic Gregorian date.

Source

pub const fn from_ymd_on(yr: i64, mo: u8, day: u8, scale: Scale) -> Self

Creates a Dt representing midnight 00:00:00 on the given Scale on the given proleptic Gregorian date.

Source

pub const fn ydoy_to_jdn(year: i64, day_of_year: u16) -> i64

Computes the Julian Day Number from a Gregorian year and ordinal day-of-year.

Source

pub const fn jdn_to_weekday(jdn: i64) -> u8

Converts a Julian Day Number to the corresponding weekday number (0 = Sunday … 6 = Saturday).

Source

pub const fn ymd_to_jdn_from_iso_week( iso_year: i64, iso_week: u8, weekday: Weekday, ) -> i64

Computes the Julian Day Number from an ISO week date (Monday-based week).

Source

pub const fn ymd_to_jdn_from_week_sun( year: i64, week: u8, weekday: Weekday, ) -> i64

Computes the Julian Day Number from a Sunday-based week-of-year (%U).

Source

pub const fn ymd_to_jdn_from_week_mon( year: i64, week: u8, weekday: Weekday, ) -> i64

Computes the Julian Day Number from a Monday-based week-of-year (%W).

Source

pub const fn is_valid_ymd(year: i64, month: u8, day: u8) -> bool

Returns true if the supplied values form a valid proleptic Gregorian calendar date.

Source

pub const fn has_iso_week_53(year: i64) -> bool

Returns true if the given Gregorian year contains an ISO week 53.

Source

pub const fn day_of_year( &self, current: Scale, ymd: Option<(i64, u8, u8)>, ) -> u16

Returns the ordinal day of the year (1-based).

January 1 is day 1; December 31 is day 365 or 366 (in leap years). Uses the proleptic Gregorian calendar.

Source

pub const fn wk_sun( &self, current: Scale, ymd: Option<(i64, u8, u8)>, doy: Option<u16>, ) -> u8

Sunday-based week number (%U in strftime).

Range: 0..=53.

  • Week 0 contains the days before the first Sunday of the year.
  • Week 1 begins on the first Sunday of the year.

The optional ymd and doy arguments are performance optimisations (same pattern used throughout the file for day_of_year, to_iso_week_date, etc.). Pass whichever you already have; the function will use the fastest path.

Source

pub const fn wk_mon( &self, current: Scale, ymd: Option<(i64, u8, u8)>, doy: Option<u16>, ) -> u8

Monday-based week number (%W in strftime).

Range: 0..=53.

  • Week 0 contains the days before the first Monday of the year.
  • Week 1 begins on the first Monday of the year.

The optional ymd and doy arguments are performance optimisations (same pattern as wk_sun, day_of_year, to_iso_week_date, etc.).

Source

pub const fn to_iso_week_date( &self, current: Scale, ymd: Option<(i64, u8, u8)>, ) -> (i64, u8, Weekday)

Returns the ISO 8601 week date for this Dt.

Returns (iso_year, iso_week, weekday) where:

  • iso_year is the ISO week year (may differ from the Gregorian year near year boundaries),
  • iso_week is the week number in the range 1..=53,
  • weekday is a Weekday value (Monday-based week).

Follows the ISO 8601 standard: weeks start on Monday and week 1 is the week containing January 4.

The optional ymd argument is a performance optimization. If provided, it is used directly; otherwise to_gregorian_ymd is called internally.

Source§

impl Dt

Source

pub const fn to_jd(&self) -> (i64, u128)

Returns the exact Julian Date of this instant as (integer_days, fractional_attoseconds).

  • The returned JD is expressed in the time scale of this Dt.
  • The fractional part is always in [0, ATTOS_PER_DAY).

For a float value use Self::to_jd_f.

Source

pub const fn to_jd_f(&self) -> Real

Returns the Julian Date of this instant as a floating-point Real.

This is the lossy counterpart to Self::to_jd.

Source

pub const fn to_mjd(&self) -> (i64, u128)

Returns the exact Modified Julian Date of this instant as (integer_days, fractional_attoseconds).

  • The returned MJD is expressed in the time scale of this Dt.
  • The fractional part is always in [0, ATTOS_PER_DAY).

For a float value use Self::to_mjd_f.

Source

pub const fn to_mjd_f(&self) -> Real

Returns the Modified Julian Date of this instant as a floating-point Real.

This is the lossy counterpart to Self::to_mjd.

Source

pub const fn from_jd(jd_days: i64, frac_attos: u128, on: Scale) -> Self

Creates a Dt from an exact Julian Date.

This is the inverse of Self::to_jd. For correct round-tripping you must pass the same on: Scale that matches the scale of the original Dt.

Source

pub const fn from_mjd(mjd_days: i64, frac_attos: u128, on: Scale) -> Self

Creates a Dt from an exact Modified Julian Date.

This is the inverse of Self::to_mjd. For correct round-tripping you must pass the same on: Scale that matches the scale of the original Dt.

Source

pub const fn from_jd_f(jd: Real, on: Scale) -> Self

Creates a Dt from a float Julian Date.

This is the inverse of Self::to_jd_f. For correct round-tripping you must pass the same on: Scale that matches the scale of the original Dt.

Source

pub const fn from_mjd_f(mjd: Real, on: Scale) -> Self

Creates a Dt from a float Modified Julian Date.

This is the inverse of Self::to_mjd_f. For correct round-tripping you must pass the same on: Scale that matches the scale of the original Dt.

Source§

impl Dt

Source

pub const fn cmp(&self, other: &Self) -> Ordering

Compares the time values represented by two Dts.

  • This comparison is based on the raw (sec, attos) representation after normalizing (without mutating self or other) any un-carried attoseconds.
  • Does not perform scale conversion.
Source

pub const fn min(self, other: Self) -> Self

Returns the smaller of two Dts according to the total physical-time order defined by Self::cmp.

This is a const fn and can be used in const contexts.

Source

pub const fn max(self, other: Self) -> Self

Returns the larger of two Dts according to the total physical-time order defined by Self::cmp.

See Self::min for more details.

Source

pub const fn eq(&self, other: &Self) -> bool

True if both sides have matching sec and attos fields.

This is a const fn so it can be used in const contexts.

Source

pub const fn lt(&self, other: &Self) -> bool

Returns true if this Dt is less than the other.

This is a const fn so it can be used in const contexts.

Source

pub const fn gt(&self, other: &Self) -> bool

Returns true if this Dt is greater than the other.

This is a const fn so it can be used in const contexts.

Source

pub const fn le(&self, other: &Self) -> bool

Returns true if this Dt is less than or equal to the other.

This is a const fn so it can be used in const contexts.

Source

pub const fn ge(&self, other: &Self) -> bool

Returns true if this Dt is greater than or equal to the other.

This is a const fn so it can be used in const contexts.

Source§

impl Dt

Source

pub const fn tdb_minus_tt(seconds_since_j2000_tt: Real) -> Real

DE440/LTE440-tuned compact analytical TT–TDB model

Exact 13-term Fourier decomposition from LTE440 (Lu et al. 2025, Table 3)

  • physical VSOP2013 annual term + tiny JPL secular corrections.
Source

pub const fn tai_to_tdb(tai: Self) -> Self

Converts a TAI Dt to TDB.

Source

pub const fn tdb_to_tai(tdb: Self) -> Self

Converts a TDB Dt to TAI.

Source§

impl Dt

Source

pub const CCSDS_C_AND_D_MAX_SIZE: usize = 32

Maximum size needed for a CCSDS C & D (CUC) binary packet (with extended P-field).

Source

pub const CCSDS_CCS_MAX_SIZE: usize = 14

Maximum size needed for a CCSDS CCS binary packet (P-field + T-field).

Source

pub fn to_ccsds_c( &self, current: Scale, n_coarse: u8, n_frac: u8, extension: bool, ) -> Result<([u8; 32], usize), DtErr>

Formats this Dt as a CCSDS C (CUC) binary time code.

Fully configurable for round-tripping with [from_ccsds_c]. Conforms to CCSDS 301.0-B-4 §3.2 (Level 1), including full support for the extended P-field (second octet) when n_coarse > 4 or n_frac > 3.

§Parameters
  • n_coarse: 1–7 (number of coarse-time octets)
  • n_frac: 0–10 (number of fractional octets)
  • extension: advisory flag (ignored when larger sizes force the second octet)
Source

pub fn to_ccsds_d( &self, current: Scale, n_day: u8, sub_ms_code: u8, extension: bool, ) -> Result<([u8; 32], usize), DtErr>

Formats this Dt as a CCSDS D (CDS) binary time code.

Fully configurable for round-tripping with [from_ccsds_d]. Conforms to CCSDS 301.0-B-4 §3.3 (Level 1): UTC day count + ms-of-day since 1958-01-01 UTC.

Source

pub fn to_ccsds_ccs( &self, current: Scale, use_doy: bool, n_subsec: u8, ) -> Result<([u8; 14], usize), DtErr>

Formats this Dt as a CCSDS CCS (Calendar Segmented Time Code).

Implements CCSDS 301.0-B-4 §3.4 (Level 1 only).

§Parameters
  • use_doy: false = Month/Day variant (most common), true = Day-of-Year variant
  • n_subsec: Number of subsecond BCD octets (06). Each octet holds 2 decimal digits.
§Returns

(buffer, written_len) — the P-field + T-field (big-endian BCD).

§Precision & Rounding

Fractional seconds are rounded to the nearest representable value at the chosen precision (exactly as to_ccsds_d does for milliseconds).

Source

pub fn to_ccsds_bin(&self, current: Scale) -> Result<([u8; 32], usize), DtErr>

Convenience method that automatically selects the most appropriate CCSDS binary time code based on current Scale.

  • If the current Scale uses leap seconds then ccsds_d is chosen.
  • Otherwise ccsds_c is chosen.
Source§

impl Dt

Source

pub const fn to_gps_wk_and_tow(&self, current: Scale) -> (i64, Dt)

Returns the GPS week number and the exact Time of Week (TOW) for this instant when expressed in GPS Time.

  • GPS Time is continuous (no leap seconds) and starts at the Dt::GPS_EPOCH (1980-01-06 00:00:00 UTC).
  • The returned TOW is a full-precision Dt (attosecond resolution) on the TAI scale.

This is the most precise way to obtain GPS week + TOW information.

Source

pub const fn to_gps_day_of_wk(&self, current: Scale) -> u8

Returns the day of the GPS week (0 = Sunday, 1 = Monday, …, 6 = Saturday).

This value is computed directly from the GPS Time of Week and is independent of the Gregorian calendar or civil time.

Source

pub const fn to_gps_tow_f(&self, current: Scale) -> Real

Returns the Time of Week (TOW) as a floating-point value in seconds.

This is a convenience method for code that prefers f64 / Real. For full attosecond precision use Self::to_gps_wk_and_tow.

Source

pub const fn to_gps_wk(&self, current: Scale) -> i64

Returns only the GPS week number.

Convenience method. For both the week number and the Time of Week, use Self::to_gps_wk_and_tow.

Source

pub const fn to_galexsec(&self, current: Scale) -> Dt

Returns the elapsed time since the GPS/Galileo Experiment (GALEX) epoch as a Dt on the TAI scale.

The GALEX epoch is Self::GPS_EPOCH.

Source

pub const fn to_gps(&self, current: Scale) -> Dt

Returns the elapsed time since the GPS epoch as a Dt on the GPS scale.

The GPS epoch is Dt::GPS_EPOCH.

Source

pub const fn to_cxcsec(&self, current: Scale) -> Dt

Returns the elapsed time since the Chandra X-ray Center (CXC) epoch as a Dt on the TT scale.

The CXC epoch is Dt::CXC_EPOCH.

Source§

impl Dt

Source

pub fn to_iso_duration(&self) -> String

Converts this Dt to an ISO 8601 duration string (e.g. "PT1H23M45.6789S", "-PT0.5S", "PT0.000000000000000001S", or "PT0S").

  • This method is only available when the alloc feature is enabled.
  • It returns alloc::string::String (no_std + alloc compatible).
Source

pub fn to_str(&self, current: Scale, fmt: &str) -> Result<String, DtErr>

High-level allocating formatter (defaults to UTC / label-only).

Equivalent to Self::to_str_with_offset with secs = 0.

This is the convenient alloc version of Self::to_str_bin.

Source

pub fn to_str_with_offset( &self, current: Scale, fmt: &str, secs: i32, ) -> Result<String, DtErr>

High-level allocating formatter with a fixed UTC offset.

  • The civil time is adjusted by the given offset before formatting, and %z/%:z directives will reflect that offset.
  • IANA name/abbreviation are not set.

This is the convenient alloc version of Self::to_str_bin_with_offset.

Source

pub fn to_str_with_tz( &self, current: Scale, fmt: &str, tz_name: &str, ) -> Result<String, DtErr>

High-level allocating formatter with full IANA timezone support (Jiff-compatible directive behavior).

Performs a correct UTC-based IANA lookup so that the following directives produce accurate results:

  • %Q / %:Q → full IANA timezone name (e.g. America/New_York)
  • %Z → timezone abbreviation (e.g. EDT). These do not round-trip.
  • %z / %:z → numeric offset

This is the convenient alloc version of Self::to_str_bin_with_tz.

Source§

impl Dt

Source

pub fn to_str_bin( &self, current: Scale, fmt: &str, ) -> Result<AsciiStr<STRFTIME_SIZE>, DtErr>

Formats this Dt into a fixed-size ASCII string without any heap allocation.

The datetime is first converted to Gregorian civil time on the given current scale, UTC (offset = 0, no timezone abbreviation or IANA name). This is the simplest no-alloc formatter.

§Errors

Returns DtErr if the format string contains invalid specifiers or if the internal formatting buffer overflows (extremely unlikely with STRFTIME_SIZE).

Source

pub fn to_str_bin_with_offset( &self, current: Scale, fmt: &str, secs: i32, ) -> Result<AsciiStr<STRFTIME_SIZE>, DtErr>

Formats this Dt into a fixed-size ASCII string without any heap allocation, applying a fixed UTC offset.

  • The civil time is adjusted by the given secs offset before formatting, and the offset is stored so that %z / %:z directives will reflect it.
  • No IANA timezone name or abbreviation is set.
Source

pub fn to_str_bin_with_tz( &self, current: Scale, fmt: &str, tz_name: &str, ) -> Result<AsciiStr<STRFTIME_SIZE>, DtErr>

Formats this Dt into a fixed-size ASCII string without any heap allocation, adjusting to the given IANA timezone.

This performs a correct UTC-based lookup in the IANA transition table, so the resulting GregorianTime contains:

  • accurate civil time
  • correct numeric offset (for %z / %:z)
  • timezone abbreviation (for %Z). These do not round-trip.
  • full IANA timezone name (for %Q / %:Q)

Use this method when you want full IANA-aware formatting (%Q, %Z, %z, etc.).

Source

pub fn to_u8_with_offset( &self, current: Scale, fmt: &str, dest: &mut [u8], secs: i32, ) -> Result<usize, DtErr>

Low-level no-alloc formatter that writes into a caller-provided slice, using a fixed UTC offset.

Same logic as Self::to_str_bin_with_offset, but writes directly into dest (truncated to dest.len()) and returns the number of bytes written.

Source

pub fn to_u8_with_tz( &self, current: Scale, fmt: &str, dest: &mut [u8], tz_name: &str, ) -> Result<usize, DtErr>

Low-level no-alloc formatter that writes into a caller-provided slice, using a full IANA timezone.

Same logic as Self::to_str_bin_with_tz, but writes directly into dest (truncated to dest.len()) and returns the number of bytes written.

Source

pub const fn sec_as_hhmm(seconds: i32) -> (bool, u8, u8)

Returns (is_negative, hours, minutes).

Source§

impl Dt

Source

pub fn proper_time_from_states<I>( samples: I, characteristic_length_scale: Real, ) -> Result<Self, DtErr>
where I: IntoIterator<Item = (Self, Velocity, Real)>,

Computes the relativistic clock drift (proper time minus coordinate time) over an interval.

This returns how much a physical clock has gained or lost time compared with coordinate time between start and end.

  • A positive result means the onboard clock ran fast.
  • A negative result means the onboard clock ran slow.
§Parameters
  • start: Starting coordinate time of the interval.
  • end: Ending coordinate time of the interval.
  • states: Iterator of physical states. Coordinate times must be monotonically non-decreasing. It is the caller’s responsibility to ensure the provided states cover the time range from start to end. The function integrates proper time over whatever states are supplied and subtracts the requested coordinate interval (end - start). Exact matching of the first and last state times to start and end is not validated.
  • characteristic_length_scale: See [proper_time_from_states].
§Returns

Ok(drift) — the accumulated drift (Δτ − Δt) as a Dt.

Err(DtErr) — if the states are not monotonically increasing in time.

Source

pub fn proper_time_drift_from_states<I>( start: Dt, end: Dt, states: I, characteristic_length_scale: Real, ) -> Result<Dt, DtErr>
where I: IntoIterator<Item = (Self, Velocity, Real)>,

Computes the relativistic clock drift (proper time minus coordinate time) over an interval.

This returns how much a physical clock has gained or lost time compared with coordinate time between start and end.

  • A positive result means the onboard clock ran fast.
  • A negative result means the onboard clock ran slow.
§Parameters
  • start: Starting coordinate time.
  • end: Ending coordinate time.
  • states: Iterator of physical states covering the interval. Coordinate times must be monotonically non-decreasing. It is the caller’s responsibility to ensure the states span the requested interval (exact first/last time matching is not checked).
  • characteristic_length_scale: See [proper_time_from_states].
§Returns

Ok(drift) — the accumulated drift (Δτ − Δt) as a Dt.

Err(DtErr) — if the states are not monotonically increasing in time.

Source

pub fn proper_time_from_path<I>(path: I) -> Result<Self, DtErr>
where I: IntoIterator<Item = (Self, Spacetime)>,

Computes accumulated proper time along an arbitrary trajectory.

This is the core integration function of the library. It walks the supplied path segment by segment and applies the trapezoidal rule to the instantaneous proper-time rate at each step.

This approach is commonly used when integrating clock rates along sampled trajectories in astrodynamics and high-precision timing work.

The function enforces that coordinate times are monotonically non-decreasing. It performs a single pass with no heap allocation.

§Parameters
  • path: An iterator of (coordinate_time, Spacetime) pairs. Coordinate times must be monotonically non-decreasing.
§Returns

Ok(total_proper_time) — the accumulated proper time as a Dt.

Err(DtErr) — if the path is empty or contains any decrease in coordinate time.

Source

pub const fn proper_time_between_constant_rate( self, end: Dt, dtau_dt: Real, ) -> Dt

Computes proper time advance over an interval when the rate is constant.

Use this for segments where conditions do not change, such as a ground station, a circular orbit, or a deep-space cruise phase with constant velocity and gravitational potential.

This is mathematically equivalent to integrating a constant rate but is more efficient and expresses intent clearly.

§Parameters
  • end: Ending coordinate time.
  • dtau_dt: Constant proper-time rate (dimensionless, usually between 0 and 1).
§Returns

The accumulated proper time advance as a Dt.

Source§

impl Dt

Source

pub fn to_str_rfc3339(&self, current: Scale) -> Result<String, DtErr>

Returns this instant as an RFC 3339 / ISO 8601 timestamp in UTC with the Z suffix.

  • Always uses UTC (Z = Zulu = UTC).
  • Default = 9 digits (nanoseconds) but automatically trims trailing zeros.
  • If fractional part is zero → no decimal point at all (e.g. ...45Z).
  • Example: "2024-03-14T15:30:45.123Z"
Source

pub fn to_str_rfc3339_nf( &self, current: Scale, max_precision: usize, ) -> Result<String, DtErr>

Same as [to_str_rfc3339] but with a configurable maximum number of fractional digits (0–18). Trailing zeros are always trimmed.

Source

pub fn to_str_iso8601(&self, current: Scale) -> Result<String, DtErr>

ISO 8601 / RFC 3339 with actual offset (modern +00:00 style).

  • Uses colon-separated offset (%:z) instead of forcing Z.
  • Still trims trailing zeros in the fractional part.
  • Example: "2025-04-16T14:30:45.123+00:00"
Source

pub fn to_str_iso8601_basic(&self, current: Scale) -> Result<String, DtErr>

Compact ISO 8601 basic format (no separators).

  • Useful for filenames, URLs, database keys, etc.
  • Example: "20250416T143045.123456789Z"
Source

pub fn to_str_http(&self, current: Scale) -> Result<String, DtErr>

HTTP-date format (RFC 7231 / RFC 1123) — always in GMT.

This is the format used in Date, Expires, Last-Modified headers. Example: "Wed, 16 Apr 2025 14:30:45 GMT"

Source

pub fn to_str_rfc2822(&self, current: Scale) -> Result<String, DtErr>

RFC 2822 date format (used in email Date headers).

Example: "Wed, 16 Apr 2025 14:30:45 +0000"

Source

pub fn to_str_iso_week_date(&self, current: Scale) -> Result<String, DtErr>

ISO 8601 week date.

Example: "2025-W16-3" (year-week-day)

Source

pub fn to_str_iso_date(&self, current: Scale) -> Result<String, DtErr>

Just the ISO date part (no time).

Example: "2025-04-16"

Source

pub fn to_str_iso_time(&self, current: Scale) -> Result<String, DtErr>

Just the time part with fractional seconds (trimmed).

Example: "14:30:45.123456789"

Source§

impl Dt

Source

pub fn to_ccsds_str(&self, current: Scale) -> Result<String, DtErr>

Returns this instant as a CCSDS ASCII Time Code (calendar variant A).

Example: "2025-04-17T14:30:45.123456789Z"

  • Uses T separator and trailing Z.
  • Fractional seconds are trimmed (no trailing zeros, no dot if zero).
  • Perfect round-trip with Dt::from_ccsds_str / TimeParts::from_ccsds_str.
Source

pub fn to_ccsds_str_nf( &self, current: Scale, max_precision: usize, ) -> Result<String, DtErr>

Same as [to_ccsds_str] but lets you control the maximum number of fractional digits (0–18).

Source

pub fn to_ccsds_doy_str(&self, current: Scale) -> Result<String, DtErr>

Returns this instant as a CCSDS ASCII Time Code B (day-of-year variant).

Example: "2025-107T14:30:45.123456789Z"

Source

pub fn to_ccsds_doy_str_nf( &self, current: Scale, max_precision: usize, ) -> Result<String, DtErr>

Same as [to_ccsds_doy_str] but with configurable fractional precision.

Source§

impl Dt

Source

pub const fn to_msd(&self, current: Scale) -> (i64, u128)

Returns the exact Mars Sol Date (MSD) as a tuple of integer sols and the fractional part of a sol.

  • The computation follows the canonical NASA GISS / AM2000 formulation and works for any input Scale.
  • Leap seconds are automatically accounted for when converting from UTC.
Source

pub const fn to_mtc(&self, current: Scale) -> Dt

Returns Mars Coordinated Time (MTC) as a Dt representing seconds into the current sol (range [0, one Martian sol)).

Source

pub const fn from_msd(whole_sols: i64, frac_attos: u128) -> Self

Creates a Dt (in TT) from an exact Mars Sol Date using full library precision.

Source

pub const fn from_msd_f(msd: Real) -> Self

Creates a Dt (in TT) from a floating-point Mars Sol Date. Non-exact Real.

Source

pub const fn to_msd_f(&self, current: Scale) -> Real

Returns the Mars Sol Date (MSD) as a floating-point value (matches NASA Mars24 output). Non-exact Real.

Source

pub fn to_mars_ls(&self, current: Scale) -> Real

Returns the Areocentric Solar Longitude Ls in degrees (range [0, 360)).

Ls is the angular position of the Sun as measured eastward from the Martian vernal equinox in Mars’s orbital plane. It is the standard index of Martian seasonal progression used in all mission planning, science operations, and atmospheric modeling. Due to orbital eccentricity, northern spring + summer last ~381 Earth days while autumn + winter last ~306 Earth days.

  • Ls = 0° → northern vernal equinox (northern spring begins)
  • Ls = 90° → northern summer solstice
  • Ls = 180° → northern autumnal equinox
  • Ls = 270° → northern winter solstice

Exactly reproduces the short-series analytic model (B-1 through B-5) used by the current NASA GISS Mars24 Sunclock algorithm, which is based on Allison & McEwen (2000) with the seven largest planetary perturbations.

Source: NASA Goddard Institute for Space Studies (GISS)
Title: Mars24 Sunclock — Algorithm and Worked Examples
URL: https://www.giss.nasa.gov/tools/mars24/help/algorithm.html
Updated: 2025-01-07

Works for any input Scale because it internally converts to TT.

Source

pub fn to_mars_lmst(&self, current: Scale, east_longitude_deg: Real) -> Dt

Returns Local Mean Solar Time (LMST) at the given planetocentric east longitude as a Dt representing seconds into the current Martian sol (range [0, one sol)).

LMST is the uniform mean solar time adjusted for longitude.

Longitude is east-positive (standard planetocentric convention, 0–360° E). Internally converts to TT and uses the current NASA GISS Mars24 definition of MST.

Source

pub fn to_mars_ltst(&self, current: Scale, east_longitude_deg: Real) -> Dt

Returns Local True Solar Time (LTST) at the given planetocentric east longitude as a Dt representing seconds into the current Martian sol (range [0, one sol)).

LTST is the actual sundial time (true solar time) at the location — what a local observer would see on a sundial. It equals LMST plus the Equation of Time.

Longitude is east-positive (standard planetocentric convention, 0–360° E).

Source

pub fn to_mars_year(&self, current: Scale) -> i64

Returns the integer Mars Year (MY) for this instant.

Mars Year numbering follows the standard Clancy et al. (2000) system:

  • Mars Year 1 begins at the northern vernal equinox (Ls = 0°) on 1955 April 11.
  • Each Mars Year is one tropical year on Mars (686.9725 Earth days).
  • Current missions operate in Mars Year 36–37 (as of 2026).

This is the canonical year count used in all Mars science literature, mission reports, and atmospheric databases.

Source: Clancy et al. (2000), J. Geophys. Res.: Planets 105(E4), 9553–9572; confirmed in NASA GISS Mars24 Technical Notes (2025) and LMD Mars Climate Database.

To get the fractional progress through the year, simply use: self.to_mars_ls(current) / 360.0

Source§

impl Dt

Source

pub fn to_hifitime(&self, current: Scale) -> Epoch

Converts this Dt to a hifitime::Epoch (TAI scale).

Round-trips perfectly with [Dt::from_hifitime].

Source

pub fn to_hifitime_duration(&self) -> Duration

Converts this Span to a hifitime::Duration (nanosecond precision).

  • Sub-nanosecond attoseconds are truncated toward zero.
  • The conversion is fully exact up to the nanosecond (128-bit integer arithmetic).
  • Internally uses hifitime::Duration::from_total_nanoseconds, which automatically normalizes centuries/nanoseconds and saturates at Duration::MAX / Duration::MIN if outside hifitime’s range (±32,768 centuries).
Source

pub fn from_hifitime_epoch(epoch: Epoch) -> Self

Creates a Dt from a hifitime::Epoch.

  • The conversion is exact (within hifitime’s nanosecond precision).
  • Uses a runtime-computed offset so it always matches whatever calendar math hifitime uses (including negative years).
Source

pub fn from_hifitime_duration(dur: Duration) -> Self

Creates a Dt from a hifitime::Duration (nanosecond precision).

This is the exact reverse of Dt::to_hifitime_duration.

Source§

impl Dt

Source

pub fn from_chrono_datetime_utc(dt: DateTime<Utc>) -> Self

Creates a Dt from a chrono::DateTime<chrono::Utc>.

This is the inverse of Dt::to_chrono_datetime_utc.

Source

pub fn from_chrono_duration(dur: Duration) -> Self

Creates a Dt from a chrono::Duration (nanosecond precision).

Source

pub fn to_chrono_datetime_utc(&self, current: Scale) -> DateTime<Utc>

Converts this Dt to a chrono::DateTime<chrono::Utc>.

  • Sub-nanosecond attoseconds are truncated toward zero.
  • Saturates at the minimum/maximum representable DateTime<Utc> (roughly years 1678–2262) if the instant is out of range.
Source

pub fn to_chrono_duration(&self) -> Duration

Converts this Dt to a chrono::Duration (nanosecond precision).

  • Sub-nanosecond attoseconds are truncated toward zero.
  • The conversion is fully exact up to the nanosecond (128-bit integer arithmetic).
  • Saturates at chrono::Duration::MIN / chrono::Duration::MAX (roughly ±292 million years) if the value is out of range.
Source§

impl Dt

Source

pub fn to_jiff_timestamp(&self, current: Scale) -> Timestamp

Converts this Dt to a jiff::Timestamp (always in UTC).

Source

pub fn to_jiff_span(&self) -> Span

Converts this Dt to a jiff::Span (seconds + nanoseconds only).

Source

pub fn to_jiff_signed_duration(&self) -> SignedDuration

Converts this Span to a jiff::SignedDuration (nanosecond precision).

  • Sub-nanosecond attoseconds are truncated toward zero.
  • Supports the entire range of Span (never saturates).
Source

pub fn from_jiff_timestamp(ts: Timestamp) -> Self

Creates a Dt from a jiff::Timestamp.

This is the inverse of Dt::to_jiff_timestamp.

Source

pub fn from_jiff_signed_duration(dur: SignedDuration) -> Self

Creates a Dt from a jiff::SignedDuration (nanosecond precision).

This is the inverse of Dt::to_jiff_signed_duration.

Source

pub fn from_jiff_span(span: Span) -> Result<Self, DtErr>

Creates a Dt from a jiff::Dt.

This is the inverse of Dt::to_jiff_span.

Source§

impl Dt

Source

pub const fn sec(&self) -> i64

Seconds field getter.

Source

pub const fn attos(&self) -> u64

Subseconds field getter (attoseconds).

Source

pub const fn carry_over_mut(&mut self) -> &mut Self

Normalizes the representation so that the attosecond part lies in the range [0, ATTOS_PER_SEC).

Source

pub const fn carry_over(&self) -> Self

Normalizes the representation so that the attosecond part lies in the range [0, ATTOS_PER_SEC).

Source§

impl Dt

Source

pub const WIRE_VERSION: u8 = 1

Current wire format version.

Source

pub const WIRE_SIZE: usize = 17

Size of the canonical wire representation in bytes (17 bytes).

Source

pub fn to_wire_bytes(&self) -> [u8; 17]

Serializes this Dt into a fixed 17-byte little-endian buffer.

§Wire Format
  • Byte 0: Version (WIRE_VERSION)
  • Bytes [1..9]: sec as little-endian i64
  • Bytes [9..17]: subsec as little-endian u64

This format is stable, portable, and suitable for network transmission, file storage, or FFI. The internal representation is always TAI.

Source

pub fn from_wire_bytes(bytes: &[u8]) -> Option<Self>

Deserializes a Dt from exactly 17 bytes of wire data.

Returns None if the version byte is unknown. Any subsec value ≥ 10¹⁸ is automatically normalized using carry_over so the resulting Dt is always in canonical form.

§Security

Safe to call with completely untrusted input. Fixed-size format, no allocation, no unsafe, and no possibility of code execution. Malicious data simply produces a normalized (but still valid) Dt.

Source§

impl Dt

Source

pub const SHAPIRO_SOLAR: Self

Shapiro gravitational time scale for the Sun (2 G M_☉ / c³).

This is the recommended value to pass as the shapiro parameter to ObserverState::one_way_relativistic_delay (and ObserverState::shapiro_delay_to) for all normal solar-system work.

It corresponds to the one-way Shapiro coefficient for the Sun.

Source

pub const fn shapiro_from_grav_param(gm: Real) -> Self

Creates the Shapiro delay scale for an arbitrary central body from its standard gravitational parameter GM (μ) in m³ s⁻².

This produces the coefficient used in the Shapiro gravitational time delay formula. It is the recommended way to create a custom Shapiro scale for planets, stars, or other massive bodies.

Pass the resulting value to ObserverState::one_way_relativistic_delay or ObserverState::shapiro_delay_to.

Source

pub const fn to_observer_state( self, position: Position, velocity: Velocity, grav_potential_m2_s2: Real, characteristic_length_scale: Real, ) -> ObserverState

Creates an ObserverState using this time value along with the provided position, velocity, and gravitational information.

An ObserverState represents a complete snapshot of an observer (spacecraft, ground station, planet, etc.) at a specific moment. It bundles together the time, position, velocity, and local gravitational environment so that relativistic calculations (light time, clock rates, Shapiro delay, etc.) can be performed.

This method is a convenience constructor. It is useful when you already have a Dt (a time value) and want to build an ObserverState directly from it, rather than calling ObserverState::new or ObserverState::new_strong_field.

§Parameters
  • position: The observer’s position in meters (typically expressed in a barycentric or heliocentric frame).
  • velocity: The observer’s velocity in meters per second.
  • grav_potential_m2_s2: The total Newtonian gravitational potential (Φ) at the observer’s location, in m²/s². This is usually negative for bound orbits and is the sum of contributions from the Sun and planets.
  • characteristic_length_scale: A length scale (in meters) over which gravity varies significantly at this location. Use 0.0 for normal solar-system and weak-field cases. Only provide a non-zero value when working in strong gravitational fields.
§When to use this method

Use this method when you already have a time value as a Dt and want to construct an ObserverState in one step. It is especially convenient when working with time values that were previously computed or converted.

For most normal use, ObserverState::new is simpler. Use ObserverState::new_strong_field instead if you need to specify a non-zero characteristic_length_scale.

§Example
let t = Dt::from_sec(1234.5);

let state = t.to_observer_state(
    position,
    velocity,
    grav_potential,
    0.0, // normal solar-system use
);
Source§

impl Dt

Source

pub const fn every(self, step: Dt) -> Every

Starts building an evenly-spaced time range.

This method returns an Every builder that can be chained with .until(end) or .up_to(end) to create a TimeRange iterator.

§Example
use deep_time::{Dt, Scale};

let start = Dt::from_ymd(2000, 1, 1);
let end = Dt::from_ymd(2000, 1, 2);
let step = Dt::from_hr(1, Scale::TAI);

for timestamp in start.every(step).to_including(end) {
    println!("{:?}", timestamp.to_ymdhms(Scale::TAI));
}
Source

pub const fn range(self, end: Dt, step: Dt) -> TimeRange

Creates an exclusive evenly-spaced range from self to end.

Equivalent to self.every(step).up_to(end).

Source

pub const fn every_sec(self) -> Every

Creates a range stepping by whole seconds.

Source

pub const fn every_min(self) -> Every

Creates a range stepping by whole minutes.

Source

pub const fn every_hr(self) -> Every

Creates a range stepping by whole hours.

Source

pub const fn every_day(self) -> Every

Creates a range stepping by whole days.

Source

pub fn next_n(self, n: usize, step: Dt) -> impl ExactSizeIterator<Item = Dt>

Returns the next n points after self (exclusive of self) at the given step.

This is a convenient way to get future points without including the start.

Source

pub fn for_n_steps( self, n: usize, step: Dt, ) -> impl ExactSizeIterator<Item = Dt>

Returns an iterator yielding exactly n evenly spaced points starting from self.

This is a convenient one-liner for the common “next N steps” pattern.

Source§

impl Dt

Source

pub const fn leap_seconds(&self, from_civil: bool) -> LeapInfo

Source

pub const fn leap_seconds_using( &self, from_civil: bool, table: &[LeapSecond], ) -> LeapInfo

Source§

impl Dt

Source

pub fn orientation_offset(mjd: Real, op_data: &BopData) -> Result<Real, DtErr>

Get an orientation parameters offset in seconds for a particular Modified Julian Date.

  • On Earth this would be the UT1 time scale.
  • Earth Orientation Parameters data is available from: https://maia.usno.navy.mil/ser7/finals2000A.all
Source

pub fn to_offset_by_bop(&self, op_data: &BopData) -> Result<Self, DtErr>

Offsets a Dt using orientation parameters data.

  • On Earth this would be the UT1 time scale.
  • Earth Orientation Parameters data is available from: https://maia.usno.navy.mil/ser7/finals2000A.all
Source

pub fn from_offset_by_bop(&self, op_data: &BopData) -> Result<Self, DtErr>

Convert a Dt already offset using orientation parameters data back to whatever it was before.

  • On Earth this would be the UT1 time scale.
  • Earth Orientation Parameters data is available from: https://maia.usno.navy.mil/ser7/finals2000A.all

Trait Implementations§

Source§

impl Add for Dt

Source§

type Output = Dt

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Dt) -> Self

Performs the + operation. Read more
Source§

impl AddAssign for Dt

Source§

fn add_assign(&mut self, rhs: Dt)

Performs the += operation. Read more
Source§

impl Clone for Dt

Source§

fn clone(&self) -> Dt

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Dt

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Dt

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Dt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<i64> for Dt

Source§

fn div(self, rhs: i64) -> Self

Divides this Dt by an integer scalar.

Source§

type Output = Dt

The resulting type after applying the / operator.
Source§

impl DivAssign<i64> for Dt

Source§

fn div_assign(&mut self, rhs: i64)

Divides this Dt by an integer scalar in place.

Source§

impl Hash for Dt

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Hashes the canonical TAI representation so that two Dts that are physically equal (after conversion) produce the same hash, regardless of the original [Scale].

1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Mul<i64> for Dt

Source§

fn mul(self, rhs: i64) -> Self

Multiplies this Dt by an integer scalar.

Source§

type Output = Dt

The resulting type after applying the * operator.
Source§

impl MulAssign<i64> for Dt

Source§

fn mul_assign(&mut self, rhs: i64)

Multiplies this Dt by an integer scalar in place.

Source§

impl Neg for Dt

Source§

fn neg(self) -> Self

Negates this Dt (returns the additive inverse).

Source§

type Output = Dt

The resulting type after applying the - operator.
Source§

impl Ord for Dt

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Dt

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Dt

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Dt

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub for Dt

Source§

type Output = Dt

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Dt) -> Self

Performs the - operation. Read more
Source§

impl SubAssign for Dt

Source§

fn sub_assign(&mut self, rhs: Dt)

Performs the -= operation. Read more
Source§

impl Tsify for Dt

Source§

const DECL: &'static str = "/**\n * Dt, and the library, is in the process of being switched from the sec\n * and subsec fields being related to the scale, TO the sec and subsec fields\n * always being TAI Epoch 2000-01-01 noon.\n * Much of the documentation is outdated and should be ignored.\n */\nexport interface Dt {\n sec: number;\n attos: number;\n}"

Source§

const SERIALIZATION_CONFIG: SerializationConfig

Source§

type JsType = JsType

Source§

fn into_js(&self) -> Result<Self::JsType, Error>
where Self: Serialize,

Source§

fn from_js<T>(js: T) -> Result<Self, Error>
where T: Into<JsValue>, Self: DeserializeOwned,

Source§

impl Copy for Dt

Source§

impl Eq for Dt

Auto Trait Implementations§

§

impl Freeze for Dt

§

impl RefUnwindSafe for Dt

§

impl Send for Dt

§

impl Sync for Dt

§

impl Unpin for Dt

§

impl UnsafeUnpin for Dt

§

impl UnwindSafe for Dt

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,