Struct governor::clock::QuantaUpkeepClock
source · pub struct QuantaUpkeepClock { /* private fields */ }
Expand description
A clock using the default quanta::Clock
structure and an upkeep thread.
This clock relies on an upkeep thread that wakes up in regular (user defined) intervals to retrieve the current time and update an atomic U64; the clock then can retrieve that time (and is as behind as, at most, that interval).
The background thread is stopped as soon as the last clone of the clock is dropped.
Whether this is faster than a QuantaClock
depends on the utilization of the rate limiter
and the upkeep interval that you pick; you should measure and compare performance before
picking one or the other.
Implementations§
source§impl QuantaUpkeepClock
impl QuantaUpkeepClock
sourcepub fn from_interval(interval: Duration) -> Result<QuantaUpkeepClock, Error>
pub fn from_interval(interval: Duration) -> Result<QuantaUpkeepClock, Error>
Returns a new QuantaUpkeepClock
with an upkeep thread that wakes up once in interval
.
sourcepub fn from_builder(builder: Upkeep) -> Result<QuantaUpkeepClock, Error>
pub fn from_builder(builder: Upkeep) -> Result<QuantaUpkeepClock, Error>
Returns a new QuantaUpkeepClock
with an upkeep thread as specified by the given builder.
Trait Implementations§
source§impl Clock for QuantaUpkeepClock
impl Clock for QuantaUpkeepClock
source§impl Clone for QuantaUpkeepClock
impl Clone for QuantaUpkeepClock
source§fn clone(&self) -> QuantaUpkeepClock
fn clone(&self) -> QuantaUpkeepClock
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for QuantaUpkeepClock
impl !RefUnwindSafe for QuantaUpkeepClock
impl Send for QuantaUpkeepClock
impl Sync for QuantaUpkeepClock
impl Unpin for QuantaUpkeepClock
impl !UnwindSafe for QuantaUpkeepClock
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)