Provides an implementation of std::future::Future
trait to be ready at some point. Sometimes,
it is needed a std::future::Future
trait instance for testing purpose in any async
function.
Add this to your Cargo.toml:
toml
[dependencies]
settimeout = "0.1.0"
Create a simple std::future::Future
implementation:
```rust use futures::executor::blockon; use std::time::Duration; use settimeout::settimeout;
async fn foo() { println!("The Future will be ready after some time"); settimeout(Duration::fromsecs(5)).await; println!("Now, it is ready"); }
fn main() { block_on(foo()); } ```
Your PRs and stars are always welcome.