diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-06-30 07:39:32 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-06-30 07:39:32 +0000 |
| commit | a8751e077f32c4da4787986d9a93ca7645e7df95 (patch) | |
| tree | 1c007cf2b5f602bb7cfc104bdac157370fd08700 /src/libstd/thread | |
| parent | bd7a3639a89e032bb28493b823c62c8abf751f65 (diff) | |
| parent | 3c29fc5f6cd69b1299cf5482a6bc991ba6b86a0f (diff) | |
| download | rust-a8751e077f32c4da4787986d9a93ca7645e7df95.tar.gz rust-a8751e077f32c4da4787986d9a93ca7645e7df95.zip | |
Rollup merge of #34547 - sanxiyn:pretty-lifetime, r=pnkfelix
Fix pretty-printing of lifetime bound Fix #34527.
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/mod.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 3bee878de35..e9736fea7b3 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -394,6 +394,19 @@ pub fn sleep_ms(ms: u32) { /// signal being received or a spurious wakeup. Platforms which do not support /// nanosecond precision for sleeping will have `dur` rounded up to the nearest /// granularity of time they can sleep for. +/// +/// # Examples +/// +/// ```rust,no_run +/// use std::{thread, time}; +/// +/// let ten_millis = time::Duration::from_millis(10); +/// let now = time::Instant::now(); +/// +/// thread::sleep(ten_millis); +/// +/// assert!(now.elapsed() >= ten_millis); +/// ``` #[stable(feature = "thread_sleep", since = "1.4.0")] pub fn sleep(dur: Duration) { imp::Thread::sleep(dur) |
