pub struct PortableInstant(pub u64);Expand description
Host-provided monotonic timestamp, measured in milliseconds from a host-chosen origin.
The origin is typically the host-process start time. The runtime
treats the origin as opaque: two PortableInstants from the same
host are comparable, but values from different hosts (or from the
same host across restarts) are not.
Tuple Fields§
§0: u64Implementations§
Source§impl PortableInstant
impl PortableInstant
Sourcepub const ORIGIN: Self
pub const ORIGIN: Self
The zero-instant (origin). Used as a sentinel for “never” in
some deadline fields; prefer Option<PortableInstant> for
optional deadlines rather than relying on this value.
Sourcepub fn saturating_elapsed_since(self, earlier: Self) -> u64
pub fn saturating_elapsed_since(self, earlier: Self) -> u64
Saturating elapsed-duration (in ms) between two instants.
If earlier > self, returns 0 rather than panicking — this
matches the common pattern of “has enough time passed?” checks
where a monotonic clock temporarily returning non-monotonic
values (clock adjustment, host bug) should degrade to “yes,
fire now” rather than underflow.
Sourcepub fn saturating_add_ms(self, ms: u64) -> Self
pub fn saturating_add_ms(self, ms: u64) -> Self
Produce a deadline ms milliseconds in the future, saturating
at u64::MAX (effectively “never”).
Sourcepub fn has_reached(self, deadline: Self) -> bool
pub fn has_reached(self, deadline: Self) -> bool
true if self is at or after deadline. Equivalent to
self >= deadline but reads more naturally at call sites
that ask “has the deadline fired?”.
Trait Implementations§
Source§impl Clone for PortableInstant
impl Clone for PortableInstant
impl Copy for PortableInstant
Source§impl Debug for PortableInstant
impl Debug for PortableInstant
Source§impl Default for PortableInstant
impl Default for PortableInstant
Source§impl<'de> Deserialize<'de> for PortableInstant
impl<'de> Deserialize<'de> for PortableInstant
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for PortableInstant
Source§impl Hash for PortableInstant
impl Hash for PortableInstant
Source§impl Ord for PortableInstant
impl Ord for PortableInstant
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PortableInstant
impl PartialEq for PortableInstant
Source§impl PartialOrd for PortableInstant
impl PartialOrd for PortableInstant
Source§impl Serialize for PortableInstant
impl Serialize for PortableInstant
impl StructuralPartialEq for PortableInstant
Auto Trait Implementations§
impl Freeze for PortableInstant
impl RefUnwindSafe for PortableInstant
impl Send for PortableInstant
impl Sync for PortableInstant
impl Unpin for PortableInstant
impl UnsafeUnpin for PortableInstant
impl UnwindSafe for PortableInstant
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> EntryIdentityKey for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MemoryPayload for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.