September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 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