[][src]Struct runtime::time::Delay

#[must_use = "futures do nothing unless awaited"]
pub struct Delay { /* fields omitted */ }

A future representing the notification that an elapsed duration has occurred.

Methods

impl Delay[src]

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

Continue execution after the duration has passed.

Examples

use runtime::time::Delay;
use std::time::{Duration, Instant};

let start = Instant::now();
let now = Delay::new(Duration::from_millis(40)).await;

assert!(now - start >= Duration::from_millis(40));

pub fn new_at(at: Instant) -> Self[src]

Continue execution after the given instant.

Examples

use runtime::time::Delay;
use std::time::{Duration, Instant};

let start = Instant::now();
let now = Delay::new_at(start + Duration::from_millis(40)).await;

assert!(now - start >= Duration::from_millis(40));

Trait Implementations

impl Debug for Delay[src]

impl Future for Delay[src]

type Output = Instant

The type of value produced on completion.

Auto Trait Implementations

impl Send for Delay

impl !Sync for Delay

impl Unpin for Delay

impl !UnwindSafe for Delay

impl !RefUnwindSafe for Delay

Blanket Implementations

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

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

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.

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

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

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

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]