Struct tokio_timer::Delay [−][src]
A future that completes at a specified instant in time.
Instances of Delay
perform no work and complete with ()
once the
specified deadline has been reached.
Delay
has a resolution of one millisecond and should not be used for tasks
that require high-resolution timers.
Methods
impl Delay
[src]
[−]
impl Delay
pub fn new(deadline: Instant) -> Delay
[src]
[−]
pub fn new(deadline: Instant) -> Delay
Create a new Delay
instance that elapses at deadline
.
Only millisecond level resolution is guaranteed. There is no guarantee
as to how the sub-millisecond portion of deadline
will be handled.
Delay
should not be used for high-resolution timer use cases.
pub fn deadline(&self) -> Instant
[src]
[−]
pub fn deadline(&self) -> Instant
Returns the instant at which the future will complete.
pub fn is_elapsed(&self) -> bool
[src]
[−]
pub fn is_elapsed(&self) -> bool
Returns true if the Delay
has elapsed
A Delay
is elapsed when the requested duration has elapsed.
pub fn reset(&mut self, deadline: Instant)
[src]
[−]
pub fn reset(&mut self, deadline: Instant)
Reset the Delay
instance to a new deadline.
Calling this function allows changing the instant at which the Delay
future completes without having to create new associated state.
This function can be called both before and after the future has completed.