Interval returned by interval
and interval_at
.
This type allows you to wait on a sequence of instants with a certain duration between each instant. Unlike calling sleep
in a loop, this lets you count the time spent between the calls to sleep
as well.
Methods
Resets the interval to complete one period after the current time.
This is equivalent to calling reset_at(Instant::now() + period)
.
Examples
use Duration;
let interval = interval;
interval.tick .await;
sleep .await;
interval.reset;
interval.tick .await;
interval.tick .await;
println!;
Resets the interval immediately.
This is equivalent to calling reset_at(Instant::now())
.
Examples
use Duration;
let interval = interval;
interval.tick .await;
sleep .await;
interval.reset_immediately;
interval.tick .await;
interval.tick .await;
println!;
Resets the interval to complete one period after the current time.
This is equivalent to calling reset_at(Instant::now() + period)
.
Examples
use Duration;
let interval = interval;
interval.tick .await;
sleep .await;
interval.reset;
interval.tick .await;
interval.tick .await;
println!;
Resets the interval to complete one period after the current time.
This is equivalent to calling reset_at(Instant::now() + period)
.
Examples
use Duration;
let interval = interval;
interval.tick .await;
sleep .await;
interval.reset;
interval.tick .await;
interval.tick .await;
println!;