Struct async_spin_sleep::util::Interval  
source · pub struct Interval { /* private fields */ }Implementations§
source§impl Interval
 
impl Interval
pub async fn wait(&mut self) -> SleepResult
sourcepub fn set_interval(&mut self, interval: Duration)
 
pub fn set_interval(&mut self, interval: Duration)
Reset interval to the specified duration.
warning This method will break the alignment set up by
Self::wakeup_at. If you want to keep the alignment,
pub fn interval(&self) -> Duration
pub fn next_wakeup(&self) -> Instant
sourcepub fn wakeup_at(&mut self, instant: Instant)
 
pub fn wakeup_at(&mut self, instant: Instant)
Sets next tick at the specified instant. After this point, timestamp will be aligned
to given instant. This may break the alignment set up by Self::set_interval.
sourcepub fn align_with_clock(
    &mut self,
    now_time_since_epoch: impl Fn() -> Duration,
    interval: Duration,
    early_wakeup_tolerance: Duration
)
 
pub fn align_with_clock( &mut self, now_time_since_epoch: impl Fn() -> Duration, interval: Duration, early_wakeup_tolerance: Duration )
Align with
let handle: Interval = todo!();
let func = || std::time::SystemTime::now() - std::time::SystemTime::UNIX_EPOCH;
handle.align_with_clock(func, handle.interval(), Default::default());sourcepub fn align_with_system_clock(
    &mut self,
    offset_sec: f64,
    interval: Duration,
    early_wakeup_tolerance: Duration
)
 
pub fn align_with_system_clock( &mut self, offset_sec: f64, interval: Duration, early_wakeup_tolerance: Duration )
Align with system clock. This is a shortcut for Interval::align_with_clock.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
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