Struct async_timer::Interval [−][src]
pub struct Interval<T = PlatformTimer> {
pub interval: Duration,
// some fields omitted
}
Expand description
Periodic Timer
On each completion, underlying timer is restarted and therefore Future
can be polled once
more.
Usage
async fn job() {
}
async fn do_a_while() {
let mut times: u8 = 0;
let mut interval = async_timer::Interval::platform_new(core::time::Duration::from_secs(1));
while times < 5 {
job().await;
interval.wait().await;
times += 1;
}
}
Fields
interval: Duration
Timer interval, change to this value will be reflected on next restart of timer.
Implementations
Creates new instance using platform timer