Rust lang sleep
use std::time::Duration;
use std::thread::sleep;
fn main() {
sleep(Duration::from_millis(2));
}
omerakgoz34
use std::time::Duration;
use std::thread::sleep;
fn main() {
sleep(Duration::from_millis(2));
}
use std::{thread, time};
loop {
let ten_millis = time::Duration::from_millis(10);
let now = time::Instant::now();
thread::sleep(ten_millis);
}
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)
}