diff options
| author | Clar Charr <clar@charr.xyz> | 2017-12-11 13:42:01 -0500 |
|---|---|---|
| committer | Clar Charr <clar@charr.xyz> | 2018-01-29 18:16:43 -0500 |
| commit | aab712cbc8f657f3e87dacd762d23c80e589ac95 (patch) | |
| tree | 5c6f8ba88c7bf2c0adebeb9b0449dec8583822c6 | |
| parent | 70f7d5842f29d4900f24420b030f144d21f3c5fc (diff) | |
| download | rust-aab712cbc8f657f3e87dacd762d23c80e589ac95.tar.gz rust-aab712cbc8f657f3e87dacd762d23c80e589ac95.zip | |
Move time::Duration to libcore
| -rw-r--r-- | src/libcore/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcore/time.rs (renamed from src/libstd/time/duration.rs) | 15 | ||||
| -rw-r--r-- | src/libstd/time.rs (renamed from src/libstd/time/mod.rs) | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index d5190b65863..2e1f925c49a 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -168,6 +168,7 @@ pub mod slice; pub mod str; pub mod hash; pub mod fmt; +pub mod time; // note: does not need to be public mod char_private; diff --git a/src/libstd/time/duration.rs b/src/libcore/time.rs index ee444830be4..1a0208d2f25 100644 --- a/src/libstd/time/duration.rs +++ b/src/libcore/time.rs @@ -7,6 +7,19 @@ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. +#![stable(feature = "duration_core", since = "1.24.0")] + +//! Temporal quantification. +//! +//! Example: +//! +//! ``` +//! use std::time::Duration; +//! +//! let five_seconds = Duration::new(5, 0); +//! // both declarations are equivalent +//! assert_eq!(Duration::new(5, 0), Duration::from_secs(5)); +//! ``` use iter::Sum; use ops::{Add, Sub, Mul, Div, AddAssign, SubAssign, MulAssign, DivAssign}; @@ -45,7 +58,7 @@ const MICROS_PER_SEC: u64 = 1_000_000; /// /// let ten_millis = Duration::from_millis(10); /// ``` -#[stable(feature = "duration", since = "1.3.0")] +#[stable(feature = "duration_core", since = "1.24.0")] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Default)] pub struct Duration { secs: u64, diff --git a/src/libstd/time/mod.rs b/src/libstd/time.rs index 6ce3b3e8a00..12f2a9bb85f 100644 --- a/src/libstd/time/mod.rs +++ b/src/libstd/time.rs @@ -29,9 +29,7 @@ use sys::time; use sys_common::FromInner; #[stable(feature = "time", since = "1.3.0")] -pub use self::duration::Duration; - -mod duration; +pub use core::time::Duration; /// A measurement of a monotonically nondecreasing clock. /// Opaque and useful only with `Duration`. |
