pub struct Instant(/* private fields */);Expand description
Typed monotonic timestamp for try_*_until deadlines.
Wraps a nanosecond count from the substrate’s steady clock. Construct
only via Instant::now or by adding a Duration to an existing
Instant. The internal representation is opaque on purpose: this is
what makes a raw u64 of microseconds or relative duration nanoseconds
fail to compile when fed to a try_*_until call.
Matches std::time::Instant’s opaque-newtype shape (we can’t use the
std type directly because it lives in std, not core — see also
parking_lot::Mutex::try_lock_until which takes std Instant on
host but the equivalent type on no_std targets).
§Examples
ⓘ
use core::time::Duration;
use ove::time::Instant;
let deadline = Instant::now() + Duration::from_millis(100);
mtx.try_lock_until(deadline)?;
// Or wait indefinitely:
mtx.try_lock_until(Instant::FOREVER)?;Implementations§
Trait Implementations§
Source§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+= operation. Read moreSource§impl Ord for Instant
impl Ord for Instant
Source§impl PartialOrd for Instant
impl PartialOrd for Instant
impl Copy for Instant
impl Eq 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