Struct clocksource::Instant
source · #[repr(transparent)]pub struct Instant<T> { /* private fields */ }
Expand description
The measurement of a monotonically nondecreasing clock. The internal
representation is the duration since an arbitrary epoch. Opaque and only
useful with other Instant
s and the Duration
types.
It is important to note that the underlying clock is not guaranteed to be steady. It is subject only to frequency corrections.
Implementations§
source§impl Instant<Seconds<u32>>
impl Instant<Seconds<u32>>
pub fn elapsed(&self) -> Duration<Seconds<u32>>
pub fn duration_since(&self, earlier: Self) -> Duration<Seconds<u32>>
pub fn checked_duration_since(
&self,
earlier: Self
) -> Option<Duration<Seconds<u32>>>
pub fn saturating_duration_since(&self, earlier: Self) -> Duration<Seconds<u32>>
pub fn checked_add(&self, other: Duration<Seconds<u32>>) -> Option<Self>
pub fn checked_sub(&self, other: Duration<Seconds<u32>>) -> Option<Self>
source§impl Instant<Seconds<AtomicU32>>
impl Instant<Seconds<AtomicU32>>
pub fn new(value: Instant<Seconds<u32>>) -> Self
pub fn load(&self, ordering: Ordering) -> Instant<Seconds<u32>>
pub fn store(&self, value: Instant<Seconds<u32>>, ordering: Ordering)
pub fn swap(
&self,
value: Instant<Seconds<u32>>,
ordering: Ordering
) -> Instant<Seconds<u32>>
pub fn compare_exchange(
&self,
current: Instant<Seconds<u32>>,
new: Instant<Seconds<u32>>,
success: Ordering,
failure: Ordering
) -> Result<Instant<Seconds<u32>>, Instant<Seconds<u32>>>
pub fn compare_exchange_weak(
&self,
current: Instant<Seconds<u32>>,
new: Instant<Seconds<u32>>,
success: Ordering,
failure: Ordering
) -> Result<Instant<Seconds<u32>>, Instant<Seconds<u32>>>
source§impl Instant<Nanoseconds<u64>>
impl Instant<Nanoseconds<u64>>
pub fn elapsed(&self) -> Duration<Nanoseconds<u64>>
pub fn duration_since(&self, earlier: Self) -> Duration<Nanoseconds<u64>>
pub fn checked_duration_since(
&self,
earlier: Self
) -> Option<Duration<Nanoseconds<u64>>>
pub fn saturating_duration_since(
&self,
earlier: Self
) -> Duration<Nanoseconds<u64>>
pub fn checked_add(&self, other: Duration<Nanoseconds<u64>>) -> Option<Self>
pub fn checked_sub(&self, other: Duration<Nanoseconds<u64>>) -> Option<Self>
source§impl Instant<Nanoseconds<AtomicU64>>
impl Instant<Nanoseconds<AtomicU64>>
pub fn new(value: Instant<Nanoseconds<u64>>) -> Self
pub fn load(&self, ordering: Ordering) -> Instant<Nanoseconds<u64>>
pub fn store(&self, value: Instant<Nanoseconds<u64>>, ordering: Ordering)
pub fn swap(
&self,
value: Instant<Nanoseconds<u64>>,
ordering: Ordering
) -> Instant<Nanoseconds<u64>>
pub fn compare_exchange(
&self,
current: Instant<Nanoseconds<u64>>,
new: Instant<Nanoseconds<u64>>,
success: Ordering,
failure: Ordering
) -> Result<Instant<Nanoseconds<u64>>, Instant<Nanoseconds<u64>>>
pub fn compare_exchange_weak(
&self,
current: Instant<Nanoseconds<u64>>,
new: Instant<Nanoseconds<u64>>,
success: Ordering,
failure: Ordering
) -> Result<Instant<Nanoseconds<u64>>, Instant<Nanoseconds<u64>>>
source§impl Instant<Nanoseconds<AtomicU64>>
impl Instant<Nanoseconds<AtomicU64>>
pub fn fetch_add(
&self,
value: Duration<Nanoseconds<u64>>,
ordering: Ordering
) -> Instant<Nanoseconds<u64>>
pub fn fetch_sub(
&self,
value: Duration<Nanoseconds<u64>>,
ordering: Ordering
) -> Instant<Nanoseconds<u64>>
Trait Implementations§
source§impl Add<Duration<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
impl Add<Duration<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
source§impl Add<Instant<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
impl Add<Instant<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
source§impl AddAssign<Duration<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
impl AddAssign<Duration<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
source§fn add_assign(&mut self, other: Duration<Nanoseconds<u64>>)
fn add_assign(&mut self, other: Duration<Nanoseconds<u64>>)
Performs the
+=
operation. Read moresource§impl<T> Ord for Instant<T>where
T: Ord,
impl<T> Ord for Instant<T>where
T: Ord,
source§impl<T> PartialOrd<Instant<T>> for Instant<T>where
T: PartialOrd,
impl<T> PartialOrd<Instant<T>> for Instant<T>where
T: PartialOrd,
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<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
impl Sub<Duration<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
source§impl Sub<Instant<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
impl Sub<Instant<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
source§impl SubAssign<Duration<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
impl SubAssign<Duration<Nanoseconds<u64>>> for Instant<Nanoseconds<u64>>
source§fn sub_assign(&mut self, other: Duration<Nanoseconds<u64>>)
fn sub_assign(&mut self, other: Duration<Nanoseconds<u64>>)
Performs the
-=
operation. Read more