Struct time::SteadyTime
source · pub struct SteadyTime(_);
Expand description
A structure representing a moment in time.
SteadyTime
s are generated by a “steady” clock, that is, a clock which
never experiences discontinuous jumps and for which time always flows at
the same rate.
Examples
Repeatedly call a function for 1 second:
let start = SteadyTime::now();
while SteadyTime::now() - start < Duration::seconds(1) {
do_some_work();
}
Implementations§
source§impl SteadyTime
impl SteadyTime
sourcepub fn now() -> SteadyTime
pub fn now() -> SteadyTime
Returns a SteadyTime
representing the current moment in time.
Trait Implementations§
source§impl Add<Duration> for SteadyTime
impl Add<Duration> for SteadyTime
§type Output = SteadyTime
type Output = SteadyTime
The resulting type after applying the
+
operator.source§impl Clone for SteadyTime
impl Clone for SteadyTime
source§fn clone(&self) -> SteadyTime
fn clone(&self) -> SteadyTime
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SteadyTime
impl Debug for SteadyTime
source§impl Display for SteadyTime
impl Display for SteadyTime
source§impl Ord for SteadyTime
impl Ord for SteadyTime
source§fn cmp(&self, other: &SteadyTime) -> Ordering
fn cmp(&self, other: &SteadyTime) -> Ordering
1.21.0 · 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
source§impl PartialEq<SteadyTime> for SteadyTime
impl PartialEq<SteadyTime> for SteadyTime
source§fn eq(&self, other: &SteadyTime) -> bool
fn eq(&self, other: &SteadyTime) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<SteadyTime> for SteadyTime
impl PartialOrd<SteadyTime> for SteadyTime
source§fn partial_cmp(&self, other: &SteadyTime) -> Option<Ordering>
fn partial_cmp(&self, other: &SteadyTime) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Sub<Duration> for SteadyTime
impl Sub<Duration> for SteadyTime
§type Output = SteadyTime
type Output = SteadyTime
The resulting type after applying the
-
operator.source§impl Sub<SteadyTime> for SteadyTime
impl Sub<SteadyTime> for SteadyTime
impl Copy for SteadyTime
impl Eq for SteadyTime
impl StructuralEq for SteadyTime
impl StructuralPartialEq for SteadyTime
Auto Trait Implementations§
impl RefUnwindSafe for SteadyTime
impl Send for SteadyTime
impl Sync for SteadyTime
impl Unpin for SteadyTime
impl UnwindSafe for SteadyTime
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