@@ -138,6 +138,24 @@ impl Duration {
138
138
Duration { secs, nanos }
139
139
}
140
140
141
+ /// Creates a new `Duration` that spans no time.
142
+ ///
143
+ /// # Examples
144
+ ///
145
+ /// ```
146
+ /// #![feature(duration_zero)]
147
+ /// use std::time::Duration;
148
+ ///
149
+ /// let duration = Duration::zero();
150
+ /// assert!(duration.is_zero());
151
+ /// assert_eq!(duration.as_nanos(), 0);
152
+ /// ```
153
+ #[ unstable( feature = "duration_zero" , issue = "73544" ) ]
154
+ #[ inline]
155
+ pub const fn zero ( ) -> Duration {
156
+ Duration { secs : 0 , nanos : 0 }
157
+ }
158
+
141
159
/// Creates a new `Duration` from the specified number of whole seconds.
142
160
///
143
161
/// # Examples
@@ -223,26 +241,6 @@ impl Duration {
223
241
}
224
242
}
225
243
226
- /// Creates a new `Duration` that spans no time.
227
- ///
228
- /// # Examples
229
- ///
230
- /// ```
231
- /// #![feature(duration_zero)]
232
- /// use std::time::Duration;
233
- ///
234
- /// let duration = Duration::zero();
235
- /// assert!(duration.is_zero());
236
- ///
237
- /// const IMMEDIATELY: Duration = Duration::zero();
238
- /// assert!(IMMEDIATELY.is_zero());
239
- /// ```
240
- #[ unstable( feature = "duration_zero" , issue = "none" ) ]
241
- #[ inline]
242
- pub const fn zero ( ) -> Duration {
243
- Duration { secs : 0 , nanos : 0 }
244
- }
245
-
246
244
/// Returns true if this `Duration` spans no time.
247
245
///
248
246
/// # Examples
@@ -260,7 +258,7 @@ impl Duration {
260
258
/// assert!(!Duration::from_nanos(1).is_zero());
261
259
/// assert!(!Duration::from_secs(1).is_zero());
262
260
/// ```
263
- #[ unstable( feature = "duration_zero" , issue = "none " ) ]
261
+ #[ unstable( feature = "duration_zero" , issue = "73544 " ) ]
264
262
#[ inline]
265
263
pub const fn is_zero ( & self ) -> bool {
266
264
self . secs == 0 && self . nanos == 0
0 commit comments