use std::thread::sleep; use std::time::Duration; fn main() { fn set_timeout(callback: fn() -> (), time: u64) -> () { sleep(Duration::from_secs(time)); callback(); } set_timeout(|| { println!("Hello World after 3 secs"); }, 3) }