@@ -23,22 +23,6 @@ const MILLIS_PER_SEC: u64 = 1_000;
23
23
const MICROS_PER_SEC : u64 = 1_000_000 ;
24
24
const MAX_NANOS_F64 : f64 = ( ( u64:: MAX as u128 + 1 ) * ( NANOS_PER_SEC as u128 ) ) as f64 ;
25
25
26
- /// The duration of one second.
27
- #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
28
- pub const SECOND : Duration = Duration :: from_secs ( 1 ) ;
29
-
30
- /// The duration of one millisecond.
31
- #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
32
- pub const MILLISECOND : Duration = Duration :: from_millis ( 1 ) ;
33
-
34
- /// The duration of one microsecond.
35
- #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
36
- pub const MICROSECOND : Duration = Duration :: from_micros ( 1 ) ;
37
-
38
- /// The duration of one nanosecond.
39
- #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
40
- pub const NANOSECOND : Duration = Duration :: from_nanos ( 1 ) ;
41
-
42
26
/// A `Duration` type to represent a span of time, typically used for system
43
27
/// timeouts.
44
28
///
@@ -75,6 +59,22 @@ pub struct Duration {
75
59
}
76
60
77
61
impl Duration {
62
+ /// The duration of one second.
63
+ #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
64
+ pub const SECOND : Duration = Duration :: from_secs ( 1 ) ;
65
+
66
+ /// The duration of one millisecond.
67
+ #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
68
+ pub const MILLISECOND : Duration = Duration :: from_millis ( 1 ) ;
69
+
70
+ /// The duration of one microsecond.
71
+ #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
72
+ pub const MICROSECOND : Duration = Duration :: from_micros ( 1 ) ;
73
+
74
+ /// The duration of one nanosecond.
75
+ #[ unstable( feature = "duration_constants" , issue = "57391" ) ]
76
+ pub const NANOSECOND : Duration = Duration :: from_nanos ( 1 ) ;
77
+
78
78
/// Creates a new `Duration` from the specified number of whole seconds and
79
79
/// additional nanoseconds.
80
80
///
0 commit comments