Struct mioco::timer::Timer
[−]
[src]
pub struct Timer { /* fields omitted */ }
A Timer generating event after a given time
Use MiocoHandle::select()
to wait for an event, or read()
to block until
done.
Note the timer effective resolution is limited by underlying mio timer.
See mioco::sleep()
for details.
Methods
impl Timer
[src]
impl Timer
[src]
fn read(&mut self) -> Instant
Read a timer to block on it until it is done.
Returns current time
TODO: Return wakeup time instead
fn try_read(&mut self) -> Option<Instant>
Try reading current time (if the timer is done)
TODO: Return wakeup time instead
fn set_timeout(&mut self, delay_ms: u64)
Set timeout for the timer
The timeout counts from the time set_timeout
is called.
Note the timer effective resolution is limited by underlying mio
timer. See mioco::sleep()
for details.
fn set_timeout_absolute(&mut self, timeout: Instant)
Set timeout for the timer using absolute time.
fn get_timeout_absolute(&mut self) -> Instant
Get absolute value of the timer timeout.