Struct Deadline
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§
§impl Deadline
impl Deadline
pub fn now() -> Deadline
pub fn now() -> Deadline
Returns a new deadline representing the current time.
This will capture both wall-clock time and monotonic time.
pub fn system_time(&self) -> SystemTime
pub fn system_time(&self) -> SystemTime
The wall-clock time of the deadline.
pub fn checked_add(&self, duration: Duration) -> Option<Deadline>
pub fn checked_add(&self, duration: Duration) -> Option<Deadline>
Adds a duration to the deadline, returning None
on overflow.
Trait Implementations§
§impl From<SystemTime> for Deadline
impl From<SystemTime> for Deadline
§fn from(system_time: SystemTime) -> Deadline
fn from(system_time: SystemTime) -> Deadline
Converts to this type from the input type.
§impl Ord for Deadline
impl Ord for Deadline
§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
Mutably borrows from an owned value. Read more