[][src]Function settimeout::set_timeout

pub fn set_timeout(duration: Duration) -> impl Future

It returns an implementation of Future trait.

Examples

Create a Future to be ready after some point:

use std::time::Duration;
use settimeout::set_timeout;
use futures::executor::block_on;

async fn foo() {
  println!("The Future will be ready after some time");
  set_timeout(Duration::from_secs(5)).await;
  println!("Now, it is ready");
}

block_on(foo());