pub struct AtomicInterval { /* private fields */ }
Implementations§
source§impl AtomicInterval
impl AtomicInterval
sourcepub fn should_update(&self, interval_time_ms: u64) -> bool
pub fn should_update(&self, interval_time_ms: u64) -> bool
true if ‘interval_time_ms’ has elapsed since last time we returned true as long as it has been ‘interval_time_ms’ since this struct was created
sourcepub fn should_update_ext(&self, interval_time_ms: u64, skip_first: bool) -> bool
pub fn should_update_ext(&self, interval_time_ms: u64, skip_first: bool) -> bool
a primary use case is periodic metric reporting, potentially from different threads true if ‘interval_time_ms’ has elapsed since last time we returned true except, if skip_first=false, false until ‘interval_time_ms’ has elapsed since this struct was created
sourcepub fn elapsed_ms(&self) -> u64
pub fn elapsed_ms(&self) -> u64
return ms elapsed since the last time the time was set
sourcepub fn remaining_until_next_interval(&self, interval_time: u64) -> u64
pub fn remaining_until_next_interval(&self, interval_time: u64) -> u64
return ms until the interval_time will have elapsed
Trait Implementations§
source§impl Debug for AtomicInterval
impl Debug for AtomicInterval
source§impl Default for AtomicInterval
impl Default for AtomicInterval
source§fn default() -> AtomicInterval
fn default() -> AtomicInterval
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for AtomicInterval
impl RefUnwindSafe for AtomicInterval
impl Send for AtomicInterval
impl Sync for AtomicInterval
impl Unpin for AtomicInterval
impl UnwindSafe for AtomicInterval
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more