Logo

Programming-Idioms

History of Idiom 45 > diff from v43 to v44

Edit summary for version 44 by LightDiscord:
[Rust] do not use milis

Version 43

2017-05-16, 19:14:43

Version 44

2018-06-16, 12:17:22

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Illustration

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Illustration
Imports
use std::{thread, time};
Imports
use std::{thread, time};
Code
thread::sleep(time::Duration::from_millis(5000));
Code
thread::sleep(time::Duration::from_secs(5));
Doc URL
https://doc.rust-lang.org/std/thread/fn.sleep.html
Doc URL
https://doc.rust-lang.org/std/thread/fn.sleep.html