Struct tokio_timer::Delay[][src]

pub struct Delay { /* fields omitted */ }

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.

Cancellation

Canceling a Delay is done by dropping the value. No additional cleanup or other work is required.

Implementations

impl Delay[src]

pub fn new(deadline: Instant) -> Delay[src]

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]

Returns the instant at which the future will complete.

pub fn is_elapsed(&self) -> bool[src]

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]

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.

Trait Implementations

impl Debug for Delay[src]

impl Future for Delay[src]

type Item = ()

The type of value that this future will resolved with if it is successful. Read more

type Error = Error

The type of error that this future will resolve with if it fails in a normal fashion. Read more

Auto Trait Implementations

impl !RefUnwindSafe for Delay

impl Send for Delay

impl Sync for Delay

impl Unpin for Delay

impl !UnwindSafe for Delay

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Future = F

The future that this type can be converted into.

type Item = <F as Future>::Item

The item that the future may resolve with.

type Error = <F as Future>::Error

The error that the future may resolve with.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.