[][src]Struct async_timer::delay::Delay

#[must_use = "Delay does nothing unless polled"]
pub struct Delay<T = PlatformTimer> { /* fields omitted */ }

Future that resolves sometime in future

Implementation notes

When Future is created, timer is not yet started. The actual timer will start only after future will be initally polled.

After timer expires, executor will be notified and next call to Future::poll shall return Ready, after which all further calls to Future::poll result in Pending without restarting timer.

Usage

 use async_timer::Delay;
 use core::time;

 Delay::platform_new(time::Duration::from_secs(2));

Methods

impl Delay[src]

pub fn platform_new(timeout: Duration) -> Self[src]

Creates new instance using PlatformTimer

impl<T: Timer> Delay<T>[src]

pub fn new(timeout: Duration) -> Self[src]

Creates new instance with specified timeout

Requires to specify Timer type (e.g. Delay::<PlatformTimer>::new())

pub fn restart(&mut self, ctx: &Context)[src]

Restarts underlying Timer.

Comparing to creating Delay the Timer will start counting immediately.

Trait Implementations

impl<T: Timer> Future for Delay<T>[src]

type Output = ()

🔬 This is a nightly-only experimental API. (futures_api)

futures in libcore are unstable

The type of value produced on completion.

Auto Trait Implementations

impl<T> Send for Delay<T> where
    T: Send

impl<T> Sync for Delay<T> where
    T: Sync

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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