@@ -102,6 +102,10 @@ impl TimeDelta {
102102 /// Panics when the duration is out of bounds.
103103 #[ inline]
104104 #[ must_use]
105+ #[ deprecated(
106+ since = "0.4.35" ,
107+ note = "Use `TimeDelta::try_weeks` instead or consider the `Days` type"
108+ ) ]
105109 pub const fn weeks ( weeks : i64 ) -> TimeDelta {
106110 expect ! ( TimeDelta :: try_weeks( weeks) , "TimeDelta::weeks out of bounds" )
107111 }
@@ -129,6 +133,10 @@ impl TimeDelta {
129133 /// Panics when the `TimeDelta` would be out of bounds.
130134 #[ inline]
131135 #[ must_use]
136+ #[ deprecated(
137+ since = "0.4.35" ,
138+ note = "Use `TimeDelta::try_days` instead or consider the `Days` type"
139+ ) ]
132140 pub const fn days ( days : i64 ) -> TimeDelta {
133141 expect ! ( TimeDelta :: try_days( days) , "TimeDelta::days out of bounds" )
134142 }
@@ -155,6 +163,7 @@ impl TimeDelta {
155163 /// Panics when the `TimeDelta` would be out of bounds.
156164 #[ inline]
157165 #[ must_use]
166+ #[ deprecated( since = "0.4.35" , note = "Use `TimeDelta::try_hours` instead" ) ]
158167 pub const fn hours ( hours : i64 ) -> TimeDelta {
159168 expect ! ( TimeDelta :: try_hours( hours) , "TimeDelta::hours out of bounds" )
160169 }
@@ -180,6 +189,7 @@ impl TimeDelta {
180189 /// Panics when the `TimeDelta` would be out of bounds.
181190 #[ inline]
182191 #[ must_use]
192+ #[ deprecated( since = "0.4.35" , note = "Use `TimeDelta::try_minutes` instead" ) ]
183193 pub const fn minutes ( minutes : i64 ) -> TimeDelta {
184194 expect ! ( TimeDelta :: try_minutes( minutes) , "TimeDelta::minutes out of bounds" )
185195 }
@@ -204,6 +214,7 @@ impl TimeDelta {
204214 /// (in this context, this is the same as `i64::MIN / 1_000` due to rounding).
205215 #[ inline]
206216 #[ must_use]
217+ #[ deprecated( since = "0.4.35" , note = "Use `TimeDelta::try_seconds` instead" ) ]
207218 pub const fn seconds ( seconds : i64 ) -> TimeDelta {
208219 expect ! ( TimeDelta :: try_seconds( seconds) , "TimeDelta::seconds out of bounds" )
209220 }
@@ -227,7 +238,7 @@ impl TimeDelta {
227238 /// Panics when the `TimeDelta` would be out of bounds, i.e. when `milliseconds` is more than
228239 /// `i64::MAX` or less than `-i64::MAX`. Notably, this is not the same as `i64::MIN`.
229240 #[ inline]
230- #[ deprecated]
241+ #[ deprecated( since = "0.4.35" , note = "Use `TimeDelta::try_milliseconds` instead" ) ]
231242 pub const fn milliseconds ( milliseconds : i64 ) -> TimeDelta {
232243 expect ! ( TimeDelta :: try_milliseconds( milliseconds) , "TimeDelta::milliseconds out of bounds" )
233244 }
@@ -683,6 +694,7 @@ mod tests {
683694 }
684695
685696 #[ test]
697+ #[ allow( deprecated) ]
686698 #[ should_panic( expected = "TimeDelta::seconds out of bounds" ) ]
687699 fn test_duration_seconds_max_overflow_panic ( ) {
688700 let _ = TimeDelta :: seconds ( i64:: MAX / 1_000 + 1 ) ;
@@ -704,6 +716,7 @@ mod tests {
704716 }
705717
706718 #[ test]
719+ #[ allow( deprecated) ]
707720 #[ should_panic( expected = "TimeDelta::seconds out of bounds" ) ]
708721 fn test_duration_seconds_min_underflow_panic ( ) {
709722 let _ = TimeDelta :: seconds ( -i64:: MAX / 1_000 - 1 ) ;
@@ -766,6 +779,7 @@ mod tests {
766779 }
767780
768781 #[ test]
782+ #[ allow( deprecated) ]
769783 #[ should_panic( expected = "TimeDelta::milliseconds out of bounds" ) ]
770784 fn test_duration_milliseconds_min_underflow_panic ( ) {
771785 // Here we ensure that trying to create a value one millisecond below the
0 commit comments