@@ -102,6 +102,10 @@ impl TimeDelta {
102
102
/// Panics when the duration is out of bounds.
103
103
#[ inline]
104
104
#[ must_use]
105
+ #[ deprecated(
106
+ since = "0.4.35" ,
107
+ note = "Use `TimeDelta::try_weeks` instead or consider the `Days` type"
108
+ ) ]
105
109
pub const fn weeks ( weeks : i64 ) -> TimeDelta {
106
110
expect ! ( TimeDelta :: try_weeks( weeks) , "TimeDelta::weeks out of bounds" )
107
111
}
@@ -129,6 +133,10 @@ impl TimeDelta {
129
133
/// Panics when the `TimeDelta` would be out of bounds.
130
134
#[ inline]
131
135
#[ must_use]
136
+ #[ deprecated(
137
+ since = "0.4.35" ,
138
+ note = "Use `TimeDelta::try_days` instead or consider the `Days` type"
139
+ ) ]
132
140
pub const fn days ( days : i64 ) -> TimeDelta {
133
141
expect ! ( TimeDelta :: try_days( days) , "TimeDelta::days out of bounds" )
134
142
}
@@ -155,6 +163,7 @@ impl TimeDelta {
155
163
/// Panics when the `TimeDelta` would be out of bounds.
156
164
#[ inline]
157
165
#[ must_use]
166
+ #[ deprecated( since = "0.4.35" , note = "Use `TimeDelta::try_hours` instead" ) ]
158
167
pub const fn hours ( hours : i64 ) -> TimeDelta {
159
168
expect ! ( TimeDelta :: try_hours( hours) , "TimeDelta::hours out of bounds" )
160
169
}
@@ -180,6 +189,7 @@ impl TimeDelta {
180
189
/// Panics when the `TimeDelta` would be out of bounds.
181
190
#[ inline]
182
191
#[ must_use]
192
+ #[ deprecated( since = "0.4.35" , note = "Use `TimeDelta::try_minutes` instead" ) ]
183
193
pub const fn minutes ( minutes : i64 ) -> TimeDelta {
184
194
expect ! ( TimeDelta :: try_minutes( minutes) , "TimeDelta::minutes out of bounds" )
185
195
}
@@ -204,6 +214,7 @@ impl TimeDelta {
204
214
/// (in this context, this is the same as `i64::MIN / 1_000` due to rounding).
205
215
#[ inline]
206
216
#[ must_use]
217
+ #[ deprecated( since = "0.4.35" , note = "Use `TimeDelta::try_seconds` instead" ) ]
207
218
pub const fn seconds ( seconds : i64 ) -> TimeDelta {
208
219
expect ! ( TimeDelta :: try_seconds( seconds) , "TimeDelta::seconds out of bounds" )
209
220
}
@@ -227,7 +238,7 @@ impl TimeDelta {
227
238
/// Panics when the `TimeDelta` would be out of bounds, i.e. when `milliseconds` is more than
228
239
/// `i64::MAX` or less than `-i64::MAX`. Notably, this is not the same as `i64::MIN`.
229
240
#[ inline]
230
- #[ deprecated]
241
+ #[ deprecated( since = "0.4.35" , note = "Use `TimeDelta::try_milliseconds` instead" ) ]
231
242
pub const fn milliseconds ( milliseconds : i64 ) -> TimeDelta {
232
243
expect ! ( TimeDelta :: try_milliseconds( milliseconds) , "TimeDelta::milliseconds out of bounds" )
233
244
}
@@ -683,6 +694,7 @@ mod tests {
683
694
}
684
695
685
696
#[ test]
697
+ #[ allow( deprecated) ]
686
698
#[ should_panic( expected = "TimeDelta::seconds out of bounds" ) ]
687
699
fn test_duration_seconds_max_overflow_panic ( ) {
688
700
let _ = TimeDelta :: seconds ( i64:: MAX / 1_000 + 1 ) ;
@@ -704,6 +716,7 @@ mod tests {
704
716
}
705
717
706
718
#[ test]
719
+ #[ allow( deprecated) ]
707
720
#[ should_panic( expected = "TimeDelta::seconds out of bounds" ) ]
708
721
fn test_duration_seconds_min_underflow_panic ( ) {
709
722
let _ = TimeDelta :: seconds ( -i64:: MAX / 1_000 - 1 ) ;
@@ -766,6 +779,7 @@ mod tests {
766
779
}
767
780
768
781
#[ test]
782
+ #[ allow( deprecated) ]
769
783
#[ should_panic( expected = "TimeDelta::milliseconds out of bounds" ) ]
770
784
fn test_duration_milliseconds_min_underflow_panic ( ) {
771
785
// Here we ensure that trying to create a value one millisecond below the
0 commit comments