Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Sleep/Rust/sleep.rust
Normal file
19
Task/Sleep/Rust/sleep.rust
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use std::{io, time, thread};
|
||||
|
||||
fn main() {
|
||||
println!("How long should we sleep in milliseconds?");
|
||||
|
||||
let mut sleep_string = String::new();
|
||||
|
||||
io::stdin().read_line(&mut sleep_string)
|
||||
.expect("Failed to read line");
|
||||
|
||||
let sleep_timer: u64 = sleep_string.trim()
|
||||
.parse()
|
||||
.expect("Not an integer");
|
||||
let sleep_duration = time::Duration::from_millis(sleep_timer);
|
||||
|
||||
println!("Sleeping...");
|
||||
thread::sleep(sleep_duration);
|
||||
println!("Awake!");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue