[][src]Crate settimeout

Contains some utility features to create a Future implementation to be used in any async function.

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());

Structs

Timer

It implements the Future trait.

Functions

set_timeout

It returns an implementation of Future trait.