Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Sleep A Thread For A Time In Rust

Code

#!/usr/bin/env cargo +nightly -Zscript

//! ```cargo
//! [package]
//! edition = "2021"
//! [dependencies]
//! ```

use std::{thread, time};

fn main() {
    let sleep_time = time::Duration::from_millis(1000);
    println!("hello");
    thread::sleep(sleep_time);
    println!("sleep");
}