pub fn set_timeout(duration: Duration) -> impl FutureExpand description
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());