@@ -138,6 +138,24 @@ impl Duration {
138138 Duration { secs, nanos }
139139 }
140140
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+
141159 /// Creates a new `Duration` from the specified number of whole seconds.
142160 ///
143161 /// # Examples
@@ -223,26 +241,6 @@ impl Duration {
223241 }
224242 }
225243
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-
246244 /// Returns true if this `Duration` spans no time.
247245 ///
248246 /// # Examples
@@ -260,7 +258,7 @@ impl Duration {
260258 /// assert!(!Duration::from_nanos(1).is_zero());
261259 /// assert!(!Duration::from_secs(1).is_zero());
262260 /// ```
263- #[ unstable( feature = "duration_zero" , issue = "none " ) ]
261+ #[ unstable( feature = "duration_zero" , issue = "73544 " ) ]
264262 #[ inline]
265263 pub const fn is_zero ( & self ) -> bool {
266264 self . secs == 0 && self . nanos == 0
0 commit comments