@@ -157,7 +157,6 @@ impl From<EpochNanoseconds> for Instant {
157
157
// ==== Private API ====
158
158
159
159
impl Instant {
160
- // TODO: Update to `i128`?
161
160
/// Adds a `TimeDuration` to the current `Instant`.
162
161
///
163
162
/// Temporal-Proposal equivalent: `AddInstant`.
@@ -272,7 +271,7 @@ impl Instant {
272
271
273
272
// Utility for converting `Instant` to `i128`.
274
273
pub fn as_i128 ( & self ) -> i128 {
275
- self . 0 . 0
274
+ self . epoch_nanoseconds ( ) . 0
276
275
}
277
276
}
278
277
@@ -369,6 +368,7 @@ impl Instant {
369
368
}
370
369
371
370
/// Returns an `Instant` by rounding the current `Instant` according to the provided settings.
371
+ #[ inline]
372
372
pub fn round ( & self , options : RoundingOptions ) -> TemporalResult < Self > {
373
373
let resolved_options = ResolvedRoundingOptions :: from_instant_options ( options) ?;
374
374
@@ -377,17 +377,21 @@ impl Instant {
377
377
}
378
378
379
379
/// Returns the `epochMilliseconds` value for this `Instant`.
380
+ #[ inline]
380
381
#[ must_use]
381
382
pub fn epoch_milliseconds ( & self ) -> i64 {
382
383
self . as_i128 ( ) . div_euclid ( 1_000_000 ) as i64
383
384
}
384
385
385
- /// Returns the `epochNanoseconds` value for this `Instant`.
386
+ /// Returns the [`EpochNanoseconds`] value for this `Instant`.
387
+ #[ inline]
386
388
#[ must_use]
387
389
pub fn epoch_nanoseconds ( & self ) -> & EpochNanoseconds {
388
390
& self . 0
389
391
}
390
392
393
+ /// Returns a [`ZonedDateTime`] for the current `Instant`.
394
+ #[ inline]
391
395
pub fn to_zoned_date_time_iso_with_provider (
392
396
& self ,
393
397
time_zone : TimeZone ,
@@ -400,6 +404,7 @@ impl Instant {
400
404
// ==== Instant Provider API ====
401
405
402
406
impl Instant {
407
+ /// Returns an RFC9557 IXDTF string representing the current `Instant`.
403
408
pub fn to_ixdtf_string_with_provider (
404
409
& self ,
405
410
timezone : Option < TimeZone > ,
@@ -410,6 +415,7 @@ impl Instant {
410
415
. map ( |x| x. write_to_string ( ) . into ( ) )
411
416
}
412
417
418
+ /// Returns a [`Writeable`] for formatting the current `Instant` in RFC9557's IXDTF.
413
419
pub fn to_ixdtf_writeable_with_provider (
414
420
& self ,
415
421
timezone : Option < TimeZone > ,
0 commit comments