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