Add to cargo.toml the dependency
[dependencies]
set_time_out = "0.2.0"
Easy peasy.
Import the function and used.
use set_time_out::set_time_out;
or
use set_time_out::set_time_out_callback;
and invoque
``` fn say_hello() { println!("Hello"); }
settimeout(1500);
say_hello(); ``` done!.
But if you need pass one function, here the correct way. It's the same, but more organized.
``` fn say_hello() { println!("Hello"); }
settimeoutcallback(1000, Same(sayhello)); ```
or without callback
``` fn say_hello() { println!("Hello"); }
settimeout_callback(1000, None); ```
The time is in milliseconds. Have nice day.