Struct mesh_channel::cancel::Deadline
source · pub struct Deadline { /* private fields */ }
Expand description
A point in time that acts as a deadline for an operation.
A deadline internally tracks both wall-clock time and, optionally, OS monotonic time. When two deadlines are compared, monotonic time is preferred, but if one or more deadlines do not have monotonic time, wall-clock time is used.
When a deadline is serialized, only its wall-clock time is serialized. The monotonic time is not useful outside of the process that generated it, since the monotonic time is not guaranteed to be consistent across processes.
Implementations§
source§impl Deadline
impl Deadline
sourcepub fn now() -> Self
pub fn now() -> Self
Returns a new deadline representing the current time.
This will capture both wall-clock time and monotonic time.
sourcepub fn instant(&self) -> Option<Instant>
pub fn instant(&self) -> Option<Instant>
The monotonic OS instant of the deadline, if there is one.
sourcepub fn system_time(&self) -> SystemTime
pub fn system_time(&self) -> SystemTime
The wall-clock time of the deadline.
sourcepub fn checked_add(&self, duration: Duration) -> Option<Self>
pub fn checked_add(&self, duration: Duration) -> Option<Self>
Adds a duration to the deadline, returning None
on overflow.
Trait Implementations§
source§impl From<SystemTime> for Deadline
impl From<SystemTime> for Deadline
source§fn from(system_time: SystemTime) -> Self
fn from(system_time: SystemTime) -> Self
source§impl Ord for Deadline
impl Ord for Deadline
source§impl PartialOrd for Deadline
impl PartialOrd for Deadline
impl Copy for Deadline
impl Eq for Deadline
Auto Trait Implementations§
impl Freeze for Deadline
impl RefUnwindSafe for Deadline
impl Send for Deadline
impl Sync for Deadline
impl Unpin for Deadline
impl UnwindSafe for Deadline
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)