pub struct Instant { /* private fields */ }Expand description
A UTC label with nanosecond precision, preserving an inserted second.
Ordering is by UTC label, not by POSIX timestamp. Construction preserves
a label; only a LeapTable can establish whether it occurred in UTC.
Implementations§
Source§impl Instant
impl Instant
Sourcepub const fn new(seconds: i64, nanos: u32) -> Option<Self>
pub const fn new(seconds: i64, nanos: u32) -> Option<Self>
An ordinary POSIX-labelled second and its fractional nanoseconds.
Sourcepub const fn leap_after(seconds: i64, nanos: u32) -> Option<Self>
pub const fn leap_after(seconds: i64, nanos: u32) -> Option<Self>
The inserted second after seconds, which must label UTC 23:59:59.
This does not assert that an insertion actually occurred on that date.
Sourcepub const fn seconds(self) -> i64
pub const fn seconds(self) -> i64
The POSIX label, or the preceding second’s label for a leap second.
Not an elapsed-seconds coordinate; use LeapTable::shift for arithmetic.
Sourcepub const fn is_leap_second(self) -> bool
pub const fn is_leap_second(self) -> bool
Whether this labels the inserted second after Self::seconds.
Trait Implementations§
impl Copy for Instant
impl Eq for Instant
Source§impl Ord for Instant
impl Ord for Instant
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Instant
impl PartialOrd for Instant
impl StructuralPartialEq for Instant
Auto Trait Implementations§
impl Freeze for Instant
impl RefUnwindSafe for Instant
impl Send for Instant
impl Sync for Instant
impl Unpin for Instant
impl UnsafeUnpin for Instant
impl UnwindSafe for Instant
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
Mutably borrows from an owned value. Read more