pub struct Instant(pub u64);Expand description
A monotonic point in time, in nanoseconds from an arbitrary origin.
The protocol cores never read a clock: every input carries the caller’s now. A plain
integer keeps the type available in no_std and makes simulated time trivial.
Tuple Fields§
§0: u64Implementations§
Source§impl Instant
impl Instant
Sourcepub const fn plus_nanos(self, ns: u64) -> Instant
pub const fn plus_nanos(self, ns: u64) -> Instant
This instant plus ns nanoseconds (saturating).
Sourcepub const fn plus_millis(self, ms: u64) -> Instant
pub const fn plus_millis(self, ms: u64) -> Instant
This instant plus ms milliseconds (saturating).
Sourcepub const fn nanos_since(self, earlier: Instant) -> u64
pub const fn nanos_since(self, earlier: Instant) -> u64
Nanoseconds from earlier to self, or 0 if earlier is later.
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 Forget for Instant
impl Freeze for Instant
impl Move 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