[][src]Trait async_timer::Timer

pub trait Timer: Send + Sync + Unpin {
    fn new(state: *const TimerState) -> Self;
fn reset(&mut self);
fn start_delay(&mut self, timeout: Duration);
fn start_interval(&mut self, interval: Duration);
fn state(&self) -> &TimerState; fn register_waker(&self, waker: &Waker) { ... } }

Describes Timer interface

Required methods

fn new(state: *const TimerState) -> Self

Creates new instance

TimerState is provided as pointer due to it being managed by abstraction that uses Timer It must be valid non-null pointer and is intended to be used with callbacks that accept pointer for user's provided data

fn reset(&mut self)

Resets timer, and cancells ongoing work, if necessary

fn start_delay(&mut self, timeout: Duration)

Starts timer as one-shot with specified timeout.

After timer is expired, TimerState will remove registered waker, if any

Cancels any non-expired jobs

fn start_interval(&mut self, interval: Duration)

Starts timer as periodic with specified interval.

Cancels any non-expired jobs

fn state(&self) -> &TimerState

Accesses state

Loading content...

Provided methods

fn register_waker(&self, waker: &Waker)

Registers waker with Timer

Loading content...

Implementors

impl Timer for AppleTimer[src]

fn register_waker(&self, waker: &Waker)[src]

impl Timer for DummyTimer[src]

fn register_waker(&self, waker: &Waker)[src]

Loading content...