| 1 |
// Prefer runtime checks if possible, as otherwise tests can't be run at all if something is |
| 2 |
// changed. |
| 3 |
|
| 4 |
use std::borrow::Borrow; |
| 5 |
use std::error::Error as StdError; |
| 6 |
use std::fmt::{Debug, Display}; |
| 7 |
use std::hash::Hash; |
| 8 |
use std::iter::Sum; |
| 9 |
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; |
| 10 |
use std::panic::{RefUnwindSafe, UnwindSafe}; |
| 11 |
use std::time::{Duration as StdDuration, Instant as StdInstant, SystemTime}; |
| 12 |
|
| 13 |
use quickcheck::Arbitrary; |
| 14 |
use rand08::distributions::{Distribution as DistributionRand08, Standard as StandardRand08}; |
| 15 |
use rand09::distr::{Distribution as DistributionRand09, StandardUniform as StandardUniformRand09}; |
| 16 |
use serde::{Deserialize, Serialize}; |
| 17 |
#[expect(deprecated)] |
| 18 |
use time::Instant; |
| 19 |
use time::format_description::well_known::iso8601; |
| 20 |
use time::format_description::{BorrowedFormatItem, Component, modifier, well_known}; |
| 21 |
use time::formatting::Formattable; |
| 22 |
use time::parsing::{Parsable, Parsed}; |
| 23 |
use time::{ |
| 24 |
Date, Duration, Error, Month, OffsetDateTime, PrimitiveDateTime, Time, UtcDateTime, UtcOffset, |
| 25 |
Weekday, error, ext, |
| 26 |
}; |
| 27 |
|
| 28 |
#[expect(clippy::cognitive_complexity, reason = "all test the same thing")] |
| 29 |
#[test] |
| 30 |
fn alignment() { |
| 31 |
macro_rules! assert_alignment { |
| 32 |
($t:ty, $alignment:expr) => { |
| 33 |
let alignment = $alignment; |
| 34 |
assert_eq!( |
| 35 |
align_of::<$t>(), |
| 36 |
alignment, |
| 37 |
"alignment of `{}` was {}", |
| 38 |
stringify!($t), |
| 39 |
alignment, |
| 40 |
); |
| 41 |
}; |
| 42 |
} |
| 43 |
|
| 44 |
assert_alignment!(Date, 4); |
| 45 |
assert_alignment!(Duration, 8); |
| 46 |
assert_alignment!(OffsetDateTime, 4); |
| 47 |
assert_alignment!(PrimitiveDateTime, 4); |
| 48 |
assert_alignment!(UtcDateTime, 4); |
| 49 |
assert_alignment!(Time, 4); |
| 50 |
assert_alignment!(UtcOffset, 1); |
| 51 |
assert_alignment!(error::ComponentRange, 8); |
| 52 |
assert_alignment!(error::ConversionRange, 1); |
| 53 |
assert_alignment!(error::DifferentVariant, 1); |
| 54 |
assert_alignment!(error::IndeterminateOffset, 1); |
| 55 |
assert_alignment!(modifier::Day, 1); |
| 56 |
assert_alignment!(modifier::Hour, 1); |
| 57 |
assert_alignment!(modifier::Minute, 1); |
| 58 |
assert_alignment!(modifier::Month, 1); |
| 59 |
assert_alignment!(modifier::OffsetHour, 1); |
| 60 |
assert_alignment!(modifier::OffsetMinute, 1); |
| 61 |
assert_alignment!(modifier::OffsetSecond, 1); |
| 62 |
assert_alignment!(modifier::Ordinal, 1); |
| 63 |
assert_alignment!(modifier::Period, 1); |
| 64 |
assert_alignment!(modifier::Second, 1); |
| 65 |
assert_alignment!(modifier::Subsecond, 1); |
| 66 |
assert_alignment!(modifier::WeekNumber, 1); |
| 67 |
assert_alignment!(modifier::Weekday, 1); |
| 68 |
assert_alignment!(modifier::Year, 1); |
| 69 |
assert_alignment!(well_known::Rfc2822, 1); |
| 70 |
assert_alignment!(well_known::Rfc3339, 1); |
| 71 |
assert_alignment!( |
| 72 |
well_known::Iso8601<{ iso8601::Config::DEFAULT.encode() }>, |
| 73 |
1 |
| 74 |
); |
| 75 |
assert_alignment!(iso8601::Config, 1); |
| 76 |
assert_alignment!(iso8601::DateKind, 1); |
| 77 |
assert_alignment!(iso8601::FormattedComponents, 1); |
| 78 |
assert_alignment!(iso8601::OffsetPrecision, 1); |
| 79 |
assert_alignment!(iso8601::TimePrecision, 1); |
| 80 |
assert_alignment!(Parsed, align_of::<u128>()); |
| 81 |
assert_alignment!(Month, 1); |
| 82 |
assert_alignment!(Weekday, 1); |
| 83 |
assert_alignment!(Error, 8); |
| 84 |
assert_alignment!(error::Format, 8); |
| 85 |
assert_alignment!(error::InvalidFormatDescription, 8); |
| 86 |
assert_alignment!(error::Parse, 8); |
| 87 |
assert_alignment!(error::ParseFromDescription, 8); |
| 88 |
assert_alignment!(error::TryFromParsed, 8); |
| 89 |
assert_alignment!(Component, 2); |
| 90 |
assert_alignment!(BorrowedFormatItem<'_>, 8); |
| 91 |
assert_alignment!(modifier::MonthRepr, 1); |
| 92 |
assert_alignment!(modifier::Padding, 1); |
| 93 |
assert_alignment!(modifier::SubsecondDigits, 1); |
| 94 |
assert_alignment!(modifier::WeekNumberRepr, 1); |
| 95 |
assert_alignment!(modifier::WeekdayRepr, 1); |
| 96 |
assert_alignment!(modifier::YearRepr, 1); |
| 97 |
} |
| 98 |
|
| 99 |
#[expect(clippy::cognitive_complexity, reason = "all test the same thing")] |
| 100 |
#[test] |
| 101 |
fn size() { |
| 102 |
macro_rules! assert_size { |
| 103 |
($t:ty, $size:literal, $opt_size:literal) => { |
| 104 |
assert!( |
| 105 |
size_of::<$t>() <= $size, |
| 106 |
concat!("size of `{}` used to be ", $size, ", but is now {}"), |
| 107 |
stringify!($t), |
| 108 |
size_of::<$t>(), |
| 109 |
); |
| 110 |
assert!( |
| 111 |
size_of::<Option<$t>>() <= $opt_size, |
| 112 |
concat!( |
| 113 |
"size of `Option<{}>` used to be ", |
| 114 |
$opt_size, |
| 115 |
", but is now {}" |
| 116 |
), |
| 117 |
stringify!($t), |
| 118 |
size_of::<Option<$t>>(), |
| 119 |
); |
| 120 |
}; |
| 121 |
} |
| 122 |
|
| 123 |
assert_size!(Date, 4, 4); |
| 124 |
assert_size!(Duration, 16, 16); |
| 125 |
assert_size!(OffsetDateTime, 16, 16); |
| 126 |
assert_size!(PrimitiveDateTime, 12, 12); |
| 127 |
assert_size!(UtcDateTime, 12, 12); |
| 128 |
assert_size!(Time, 8, 8); |
| 129 |
assert_size!(UtcOffset, 3, 4); |
| 130 |
assert_size!(error::ComponentRange, 24, 24); |
| 131 |
assert_size!(error::ConversionRange, 0, 1); |
| 132 |
assert_size!(error::DifferentVariant, 0, 1); |
| 133 |
assert_size!(error::IndeterminateOffset, 0, 1); |
| 134 |
assert_size!(modifier::Day, 1, 1); |
| 135 |
assert_size!(modifier::Hour, 2, 2); |
| 136 |
assert_size!(modifier::Minute, 1, 1); |
| 137 |
assert_size!(modifier::Month, 3, 3); |
| 138 |
assert_size!(modifier::OffsetHour, 2, 2); |
| 139 |
assert_size!(modifier::OffsetMinute, 1, 1); |
| 140 |
assert_size!(modifier::OffsetSecond, 1, 1); |
| 141 |
assert_size!(modifier::Ordinal, 1, 1); |
| 142 |
assert_size!(modifier::Period, 2, 2); |
| 143 |
assert_size!(modifier::Second, 1, 1); |
| 144 |
assert_size!(modifier::Subsecond, 1, 1); |
| 145 |
assert_size!(modifier::WeekNumber, 2, 2); |
| 146 |
assert_size!(modifier::Weekday, 3, 3); |
| 147 |
assert_size!(modifier::Year, 5, 5); |
| 148 |
assert_size!(well_known::Rfc2822, 0, 1); |
| 149 |
assert_size!(well_known::Rfc3339, 0, 1); |
| 150 |
assert_size!( |
| 151 |
well_known::Iso8601<{ iso8601::Config::DEFAULT.encode() }>, |
| 152 |
0, |
| 153 |
1 |
| 154 |
); |
| 155 |
assert_size!(iso8601::Config, 7, 7); |
| 156 |
assert_size!(iso8601::DateKind, 1, 1); |
| 157 |
assert_size!(iso8601::FormattedComponents, 1, 1); |
| 158 |
assert_size!(iso8601::OffsetPrecision, 1, 1); |
| 159 |
assert_size!(iso8601::TimePrecision, 2, 2); |
| 160 |
assert_size!(Parsed, 64, 64); |
| 161 |
assert_size!(Month, 1, 1); |
| 162 |
assert_size!(Weekday, 1, 1); |
| 163 |
assert_size!(Error, 48, 48); |
| 164 |
assert_size!(error::Format, 24, 24); |
| 165 |
assert_size!(error::InvalidFormatDescription, 48, 48); |
| 166 |
assert_size!(error::Parse, 32, 32); |
| 167 |
assert_size!(error::ParseFromDescription, 24, 24); |
| 168 |
assert_size!(error::TryFromParsed, 24, 24); |
| 169 |
assert_size!(Component, 6, 6); |
| 170 |
assert_size!(BorrowedFormatItem<'_>, 24, 24); |
| 171 |
assert_size!(modifier::MonthRepr, 1, 1); |
| 172 |
assert_size!(modifier::Padding, 1, 1); |
| 173 |
assert_size!(modifier::SubsecondDigits, 1, 1); |
| 174 |
assert_size!(modifier::WeekNumberRepr, 1, 1); |
| 175 |
assert_size!(modifier::WeekdayRepr, 1, 1); |
| 176 |
assert_size!(modifier::YearRepr, 1, 1); |
| 177 |
} |
| 178 |
|
| 179 |
macro_rules! assert_obj_safe { |
| 180 |
($($xs:path),+ $(,)?) => { |
| 181 |
$(const _: Option<&dyn $xs> = None;)+ |
| 182 |
}; |
| 183 |
} |
| 184 |
|
| 185 |
assert_obj_safe!(ext::NumericalDuration); |
| 186 |
assert_obj_safe!(ext::NumericalStdDuration); |
| 187 |
// `Parsable` is not object safe. |
| 188 |
// `Formattable` is not object safe. |
| 189 |
|
| 190 |
macro_rules! assert_impl { |
| 191 |
($(#[$meta:meta])* $($(@$lifetimes:lifetime),+ ;)? $type:ty: $($trait:path),+ $(,)?) => { |
| 192 |
$(#[$meta])* |
| 193 |
const _: fn() = || { |
| 194 |
fn assert_impl_all<$($($lifetimes,)+)? T: ?Sized $(+ $trait)+>() {} |
| 195 |
assert_impl_all::<$type>(); |
| 196 |
}; |
| 197 |
}; |
| 198 |
} |
| 199 |
|
| 200 |
assert_impl! { @'a; Date: |
| 201 |
Add<Duration, Output = Date>, |
| 202 |
Add<StdDuration, Output = Date>, |
| 203 |
AddAssign<Duration>, |
| 204 |
AddAssign<StdDuration>, |
| 205 |
Arbitrary, |
| 206 |
Clone, |
| 207 |
Debug, |
| 208 |
Deserialize<'a>, |
| 209 |
Display, |
| 210 |
Hash, |
| 211 |
Ord, |
| 212 |
PartialEq<Date>, |
| 213 |
PartialOrd<Date>, |
| 214 |
Serialize, |
| 215 |
Sub<Date, Output = Duration>, |
| 216 |
Sub<Duration, Output = Date>, |
| 217 |
Sub<StdDuration, Output = Date>, |
| 218 |
SubAssign<Duration>, |
| 219 |
SubAssign<StdDuration>, |
| 220 |
TryFrom<Parsed, Error = error::TryFromParsed>, |
| 221 |
Copy, |
| 222 |
Eq, |
| 223 |
RefUnwindSafe, |
| 224 |
Send, |
| 225 |
Sync, |
| 226 |
Unpin, |
| 227 |
UnwindSafe, |
| 228 |
} |
| 229 |
assert_impl! { @'a; Duration: |
| 230 |
Add<Duration, Output = Duration>, |
| 231 |
Add<StdDuration, Output = Duration>, |
| 232 |
AddAssign<Duration>, |
| 233 |
AddAssign<StdDuration>, |
| 234 |
Arbitrary, |
| 235 |
Clone, |
| 236 |
Debug, |
| 237 |
Default, |
| 238 |
Deserialize<'a>, |
| 239 |
Div<Duration, Output = f64>, |
| 240 |
Div<StdDuration, Output = f64>, |
| 241 |
Div<f32, Output = Duration>, |
| 242 |
Div<f64, Output = Duration>, |
| 243 |
Div<i16, Output = Duration>, |
| 244 |
Div<i32, Output = Duration>, |
| 245 |
Div<i8, Output = Duration>, |
| 246 |
Div<u16, Output = Duration>, |
| 247 |
Div<u32, Output = Duration>, |
| 248 |
Div<u8, Output = Duration>, |
| 249 |
DivAssign<f32>, |
| 250 |
DivAssign<f64>, |
| 251 |
DivAssign<i16>, |
| 252 |
DivAssign<i32>, |
| 253 |
DivAssign<i8>, |
| 254 |
DivAssign<u16>, |
| 255 |
DivAssign<u32>, |
| 256 |
DivAssign<u8>, |
| 257 |
Hash, |
| 258 |
Mul<f32, Output = Duration>, |
| 259 |
Mul<f64, Output = Duration>, |
| 260 |
Mul<i16, Output = Duration>, |
| 261 |
Mul<i32, Output = Duration>, |
| 262 |
Mul<i8, Output = Duration>, |
| 263 |
Mul<u16, Output = Duration>, |
| 264 |
Mul<u32, Output = Duration>, |
| 265 |
Mul<u8, Output = Duration>, |
| 266 |
MulAssign<f32>, |
| 267 |
MulAssign<f64>, |
| 268 |
MulAssign<i16>, |
| 269 |
MulAssign<i32>, |
| 270 |
MulAssign<i8>, |
| 271 |
MulAssign<u16>, |
| 272 |
MulAssign<u32>, |
| 273 |
MulAssign<u8>, |
| 274 |
Neg<Output = Duration>, |
| 275 |
Ord, |
| 276 |
PartialEq<Duration>, |
| 277 |
PartialEq<StdDuration>, |
| 278 |
PartialOrd<Duration>, |
| 279 |
PartialOrd<StdDuration>, |
| 280 |
Serialize, |
| 281 |
Sub<Duration, Output = Duration>, |
| 282 |
Sub<StdDuration, Output = Duration>, |
| 283 |
SubAssign<Duration>, |
| 284 |
SubAssign<StdDuration>, |
| 285 |
Sum<&'a Duration>, |
| 286 |
Sum<Duration>, |
| 287 |
TryFrom<StdDuration, Error = error::ConversionRange>, |
| 288 |
Copy, |
| 289 |
Eq, |
| 290 |
RefUnwindSafe, |
| 291 |
Send, |
| 292 |
Sync, |
| 293 |
Unpin, |
| 294 |
UnwindSafe, |
| 295 |
} |
| 296 |
assert_impl! { #[expect(deprecated)] Instant: |
| 297 |
Add<Duration, Output = Instant>, |
| 298 |
Add<StdDuration, Output = Instant>, |
| 299 |
AddAssign<Duration>, |
| 300 |
AddAssign<StdDuration>, |
| 301 |
AsRef<StdInstant>, |
| 302 |
Borrow<StdInstant>, |
| 303 |
Clone, |
| 304 |
Debug, |
| 305 |
From<StdInstant>, |
| 306 |
Hash, |
| 307 |
Ord, |
| 308 |
PartialEq<Instant>, |
| 309 |
PartialEq<StdInstant>, |
| 310 |
PartialOrd<Instant>, |
| 311 |
PartialOrd<StdInstant>, |
| 312 |
Sub<Duration, Output = Instant>, |
| 313 |
Sub<StdDuration, Output = Instant>, |
| 314 |
Sub<Instant, Output = Duration>, |
| 315 |
Sub<StdInstant, Output = Duration>, |
| 316 |
SubAssign<Duration>, |
| 317 |
SubAssign<StdDuration>, |
| 318 |
Copy, |
| 319 |
Eq, |
| 320 |
RefUnwindSafe, |
| 321 |
Send, |
| 322 |
Sync, |
| 323 |
Unpin, |
| 324 |
UnwindSafe, |
| 325 |
} |
| 326 |
assert_impl! { @'a; OffsetDateTime: |
| 327 |
Add<Duration, Output = OffsetDateTime>, |
| 328 |
Add<StdDuration, Output = OffsetDateTime>, |
| 329 |
AddAssign<Duration>, |
| 330 |
AddAssign<StdDuration>, |
| 331 |
Arbitrary, |
| 332 |
Clone, |
| 333 |
Debug, |
| 334 |
Deserialize<'a>, |
| 335 |
Display, |
| 336 |
From<SystemTime>, |
| 337 |
Hash, |
| 338 |
Ord, |
| 339 |
PartialEq<OffsetDateTime>, |
| 340 |
PartialEq<SystemTime>, |
| 341 |
PartialOrd<OffsetDateTime>, |
| 342 |
PartialOrd<SystemTime>, |
| 343 |
Serialize, |
| 344 |
Sub<OffsetDateTime, Output = Duration>, |
| 345 |
Sub<SystemTime, Output = Duration>, |
| 346 |
Sub<Duration, Output = OffsetDateTime>, |
| 347 |
Sub<StdDuration, Output = OffsetDateTime>, |
| 348 |
SubAssign<Duration>, |
| 349 |
SubAssign<StdDuration>, |
| 350 |
TryFrom<Parsed, Error = error::TryFromParsed>, |
| 351 |
Copy, |
| 352 |
Eq, |
| 353 |
RefUnwindSafe, |
| 354 |
Send, |
| 355 |
Sync, |
| 356 |
Unpin, |
| 357 |
UnwindSafe, |
| 358 |
} |
| 359 |
assert_impl! { @'a; PrimitiveDateTime: |
| 360 |
Add<Duration, Output = PrimitiveDateTime>, |
| 361 |
Add<StdDuration, Output = PrimitiveDateTime>, |
| 362 |
AddAssign<Duration>, |
| 363 |
AddAssign<StdDuration>, |
| 364 |
Arbitrary, |
| 365 |
Clone, |
| 366 |
Debug, |
| 367 |
Deserialize<'a>, |
| 368 |
Display, |
| 369 |
Hash, |
| 370 |
Ord, |
| 371 |
PartialEq<PrimitiveDateTime>, |
| 372 |
PartialOrd<PrimitiveDateTime>, |
| 373 |
Serialize, |
| 374 |
Sub<Duration, Output = PrimitiveDateTime>, |
| 375 |
Sub<StdDuration, Output = PrimitiveDateTime>, |
| 376 |
Sub<PrimitiveDateTime>, |
| 377 |
SubAssign<Duration>, |
| 378 |
SubAssign<StdDuration>, |
| 379 |
TryFrom<Parsed, Error = error::TryFromParsed>, |
| 380 |
Copy, |
| 381 |
Eq, |
| 382 |
RefUnwindSafe, |
| 383 |
Send, |
| 384 |
Sync, |
| 385 |
Unpin, |
| 386 |
UnwindSafe, |
| 387 |
} |
| 388 |
assert_impl! { @'a; UtcDateTime: |
| 389 |
Add<Duration, Output = UtcDateTime>, |
| 390 |
Add<StdDuration, Output = UtcDateTime>, |
| 391 |
AddAssign<Duration>, |
| 392 |
AddAssign<StdDuration>, |
| 393 |
Arbitrary, |
| 394 |
Clone, |
| 395 |
Debug, |
| 396 |
Deserialize<'a>, |
| 397 |
Display, |
| 398 |
Hash, |
| 399 |
Ord, |
| 400 |
PartialEq<UtcDateTime>, |
| 401 |
PartialEq<OffsetDateTime>, |
| 402 |
PartialEq<SystemTime>, |
| 403 |
PartialOrd<UtcDateTime>, |
| 404 |
PartialOrd<OffsetDateTime>, |
| 405 |
PartialOrd<SystemTime>, |
| 406 |
Serialize, |
| 407 |
Sub<Duration, Output = UtcDateTime>, |
| 408 |
Sub<StdDuration, Output = UtcDateTime>, |
| 409 |
Sub<UtcDateTime>, |
| 410 |
Sub<OffsetDateTime>, |
| 411 |
SubAssign<Duration>, |
| 412 |
SubAssign<StdDuration>, |
| 413 |
TryFrom<Parsed, Error = error::TryFromParsed>, |
| 414 |
Copy, |
| 415 |
Eq, |
| 416 |
RefUnwindSafe, |
| 417 |
Send, |
| 418 |
Sync, |
| 419 |
Unpin, |
| 420 |
UnwindSafe, |
| 421 |
} |
| 422 |
assert_impl! { @'a; Time: |
| 423 |
Add<Duration, Output = Time>, |
| 424 |
Add<StdDuration, Output = Time>, |
| 425 |
AddAssign<Duration>, |
| 426 |
AddAssign<StdDuration>, |
| 427 |
Arbitrary, |
| 428 |
Clone, |
| 429 |
Debug, |
| 430 |
Deserialize<'a>, |
| 431 |
Display, |
| 432 |
Hash, |
| 433 |
Ord, |
| 434 |
PartialEq<Time>, |
| 435 |
PartialOrd<Time>, |
| 436 |
Serialize, |
| 437 |
Sub<Duration, Output = Time>, |
| 438 |
Sub<StdDuration, Output = Time>, |
| 439 |
Sub<Time, Output = Duration>, |
| 440 |
SubAssign<Duration>, |
| 441 |
SubAssign<StdDuration>, |
| 442 |
TryFrom<Parsed, Error = error::TryFromParsed>, |
| 443 |
Copy, |
| 444 |
Eq, |
| 445 |
RefUnwindSafe, |
| 446 |
Send, |
| 447 |
Sync, |
| 448 |
Unpin, |
| 449 |
UnwindSafe, |
| 450 |
} |
| 451 |
assert_impl! { @'a; UtcOffset: |
| 452 |
Arbitrary, |
| 453 |
Clone, |
| 454 |
Debug, |
| 455 |
Deserialize<'a>, |
| 456 |
Display, |
| 457 |
Hash, |
| 458 |
Neg, |
| 459 |
Ord, |
| 460 |
PartialEq<UtcOffset>, |
| 461 |
PartialOrd<UtcOffset>, |
| 462 |
Serialize, |
| 463 |
TryFrom<Parsed, Error = error::TryFromParsed>, |
| 464 |
Copy, |
| 465 |
Eq, |
| 466 |
RefUnwindSafe, |
| 467 |
Send, |
| 468 |
Sync, |
| 469 |
Unpin, |
| 470 |
UnwindSafe, |
| 471 |
} |
| 472 |
assert_impl! { error::ComponentRange: |
| 473 |
Clone, |
| 474 |
Debug, |
| 475 |
Display, |
| 476 |
StdError, |
| 477 |
serde::de::Expected, |
| 478 |
Hash, |
| 479 |
PartialEq<error::ComponentRange>, |
| 480 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 481 |
TryFrom<error::TryFromParsed, Error = error::DifferentVariant>, |
| 482 |
Copy, |
| 483 |
Eq, |
| 484 |
RefUnwindSafe, |
| 485 |
Send, |
| 486 |
Sync, |
| 487 |
Unpin, |
| 488 |
UnwindSafe, |
| 489 |
} |
| 490 |
assert_impl! { error::ConversionRange: |
| 491 |
Clone, |
| 492 |
Debug, |
| 493 |
Display, |
| 494 |
StdError, |
| 495 |
PartialEq<error::ConversionRange>, |
| 496 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 497 |
Copy, |
| 498 |
Eq, |
| 499 |
RefUnwindSafe, |
| 500 |
Send, |
| 501 |
Sync, |
| 502 |
Unpin, |
| 503 |
UnwindSafe, |
| 504 |
} |
| 505 |
assert_impl! { error::DifferentVariant: |
| 506 |
Clone, |
| 507 |
Debug, |
| 508 |
Display, |
| 509 |
StdError, |
| 510 |
PartialEq<error::DifferentVariant>, |
| 511 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 512 |
Copy, |
| 513 |
Eq, |
| 514 |
RefUnwindSafe, |
| 515 |
Send, |
| 516 |
Sync, |
| 517 |
Unpin, |
| 518 |
UnwindSafe, |
| 519 |
} |
| 520 |
assert_impl! { error::IndeterminateOffset: |
| 521 |
Clone, |
| 522 |
Debug, |
| 523 |
Display, |
| 524 |
StdError, |
| 525 |
PartialEq<error::IndeterminateOffset>, |
| 526 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 527 |
Copy, |
| 528 |
Eq, |
| 529 |
RefUnwindSafe, |
| 530 |
Send, |
| 531 |
Sync, |
| 532 |
Unpin, |
| 533 |
UnwindSafe, |
| 534 |
} |
| 535 |
assert_impl! { modifier::Day: |
| 536 |
Clone, |
| 537 |
Debug, |
| 538 |
Default, |
| 539 |
PartialEq<modifier::Day>, |
| 540 |
Copy, |
| 541 |
Eq, |
| 542 |
RefUnwindSafe, |
| 543 |
Send, |
| 544 |
Sync, |
| 545 |
Unpin, |
| 546 |
UnwindSafe, |
| 547 |
} |
| 548 |
assert_impl! { modifier::Hour: |
| 549 |
Clone, |
| 550 |
Debug, |
| 551 |
Default, |
| 552 |
PartialEq<modifier::Hour>, |
| 553 |
Copy, |
| 554 |
Eq, |
| 555 |
RefUnwindSafe, |
| 556 |
Send, |
| 557 |
Sync, |
| 558 |
Unpin, |
| 559 |
UnwindSafe, |
| 560 |
} |
| 561 |
assert_impl! { modifier::Minute: |
| 562 |
Clone, |
| 563 |
Debug, |
| 564 |
Default, |
| 565 |
PartialEq<modifier::Minute>, |
| 566 |
Copy, |
| 567 |
Eq, |
| 568 |
RefUnwindSafe, |
| 569 |
Send, |
| 570 |
Sync, |
| 571 |
Unpin, |
| 572 |
UnwindSafe, |
| 573 |
} |
| 574 |
assert_impl! { modifier::Month: |
| 575 |
Clone, |
| 576 |
Debug, |
| 577 |
Default, |
| 578 |
PartialEq<modifier::Month>, |
| 579 |
Copy, |
| 580 |
Eq, |
| 581 |
RefUnwindSafe, |
| 582 |
Send, |
| 583 |
Sync, |
| 584 |
Unpin, |
| 585 |
UnwindSafe, |
| 586 |
} |
| 587 |
assert_impl! { modifier::OffsetHour: |
| 588 |
Clone, |
| 589 |
Debug, |
| 590 |
Default, |
| 591 |
PartialEq<modifier::OffsetHour>, |
| 592 |
Copy, |
| 593 |
Eq, |
| 594 |
RefUnwindSafe, |
| 595 |
Send, |
| 596 |
Sync, |
| 597 |
Unpin, |
| 598 |
UnwindSafe, |
| 599 |
} |
| 600 |
assert_impl! { modifier::OffsetMinute: |
| 601 |
Clone, |
| 602 |
Debug, |
| 603 |
Default, |
| 604 |
PartialEq<modifier::OffsetMinute>, |
| 605 |
Copy, |
| 606 |
Eq, |
| 607 |
RefUnwindSafe, |
| 608 |
Send, |
| 609 |
Sync, |
| 610 |
Unpin, |
| 611 |
UnwindSafe, |
| 612 |
} |
| 613 |
assert_impl! { modifier::OffsetSecond: |
| 614 |
Clone, |
| 615 |
Debug, |
| 616 |
Default, |
| 617 |
PartialEq<modifier::OffsetSecond>, |
| 618 |
Copy, |
| 619 |
Eq, |
| 620 |
RefUnwindSafe, |
| 621 |
Send, |
| 622 |
Sync, |
| 623 |
Unpin, |
| 624 |
UnwindSafe, |
| 625 |
} |
| 626 |
assert_impl! { modifier::Ordinal: |
| 627 |
Clone, |
| 628 |
Debug, |
| 629 |
Default, |
| 630 |
PartialEq<modifier::Ordinal>, |
| 631 |
Copy, |
| 632 |
Eq, |
| 633 |
RefUnwindSafe, |
| 634 |
Send, |
| 635 |
Sync, |
| 636 |
Unpin, |
| 637 |
UnwindSafe, |
| 638 |
} |
| 639 |
assert_impl! { modifier::Period: |
| 640 |
Clone, |
| 641 |
Debug, |
| 642 |
Default, |
| 643 |
PartialEq<modifier::Period>, |
| 644 |
Copy, |
| 645 |
Eq, |
| 646 |
RefUnwindSafe, |
| 647 |
Send, |
| 648 |
Sync, |
| 649 |
Unpin, |
| 650 |
UnwindSafe, |
| 651 |
} |
| 652 |
assert_impl! { modifier::Second: |
| 653 |
Clone, |
| 654 |
Debug, |
| 655 |
Default, |
| 656 |
PartialEq<modifier::Second>, |
| 657 |
Copy, |
| 658 |
Eq, |
| 659 |
RefUnwindSafe, |
| 660 |
Send, |
| 661 |
Sync, |
| 662 |
Unpin, |
| 663 |
UnwindSafe, |
| 664 |
} |
| 665 |
assert_impl! { modifier::Subsecond: |
| 666 |
Clone, |
| 667 |
Debug, |
| 668 |
Default, |
| 669 |
PartialEq<modifier::Subsecond>, |
| 670 |
Copy, |
| 671 |
Eq, |
| 672 |
RefUnwindSafe, |
| 673 |
Send, |
| 674 |
Sync, |
| 675 |
Unpin, |
| 676 |
UnwindSafe, |
| 677 |
} |
| 678 |
assert_impl! { modifier::WeekNumber: |
| 679 |
Clone, |
| 680 |
Debug, |
| 681 |
Default, |
| 682 |
PartialEq<modifier::WeekNumber>, |
| 683 |
Copy, |
| 684 |
Eq, |
| 685 |
RefUnwindSafe, |
| 686 |
Send, |
| 687 |
Sync, |
| 688 |
Unpin, |
| 689 |
UnwindSafe, |
| 690 |
} |
| 691 |
assert_impl! { modifier::Weekday: |
| 692 |
Clone, |
| 693 |
Debug, |
| 694 |
Default, |
| 695 |
PartialEq<modifier::Weekday>, |
| 696 |
Copy, |
| 697 |
Eq, |
| 698 |
RefUnwindSafe, |
| 699 |
Send, |
| 700 |
Sync, |
| 701 |
Unpin, |
| 702 |
UnwindSafe, |
| 703 |
} |
| 704 |
assert_impl! { modifier::Year: |
| 705 |
Clone, |
| 706 |
Debug, |
| 707 |
Default, |
| 708 |
PartialEq<modifier::Year>, |
| 709 |
Copy, |
| 710 |
Eq, |
| 711 |
RefUnwindSafe, |
| 712 |
Send, |
| 713 |
Sync, |
| 714 |
Unpin, |
| 715 |
UnwindSafe, |
| 716 |
} |
| 717 |
assert_impl! { well_known::Rfc2822: |
| 718 |
Clone, |
| 719 |
Debug, |
| 720 |
PartialEq<well_known::Rfc2822>, |
| 721 |
Copy, |
| 722 |
Eq, |
| 723 |
Formattable, |
| 724 |
Parsable, |
| 725 |
RefUnwindSafe, |
| 726 |
Send, |
| 727 |
Sync, |
| 728 |
Unpin, |
| 729 |
UnwindSafe, |
| 730 |
} |
| 731 |
assert_impl! { well_known::Rfc3339: |
| 732 |
Clone, |
| 733 |
Debug, |
| 734 |
PartialEq<well_known::Rfc3339>, |
| 735 |
Copy, |
| 736 |
Eq, |
| 737 |
Formattable, |
| 738 |
Parsable, |
| 739 |
RefUnwindSafe, |
| 740 |
Send, |
| 741 |
Sync, |
| 742 |
Unpin, |
| 743 |
UnwindSafe, |
| 744 |
} |
| 745 |
assert_impl! { well_known::Iso8601::<{ iso8601::Config::DEFAULT.encode() }>: |
| 746 |
Clone, |
| 747 |
Debug, |
| 748 |
PartialEq<well_known::Iso8601<{ iso8601::Config::DEFAULT.encode() }>>, |
| 749 |
Copy, |
| 750 |
Eq, |
| 751 |
Formattable, |
| 752 |
Parsable, |
| 753 |
RefUnwindSafe, |
| 754 |
Send, |
| 755 |
Sync, |
| 756 |
Unpin, |
| 757 |
UnwindSafe, |
| 758 |
} |
| 759 |
assert_impl! { iso8601::Config: |
| 760 |
Debug, |
| 761 |
RefUnwindSafe, |
| 762 |
Send, |
| 763 |
Sync, |
| 764 |
Unpin, |
| 765 |
UnwindSafe, |
| 766 |
} |
| 767 |
assert_impl! { iso8601::DateKind: |
| 768 |
Clone, |
| 769 |
Debug, |
| 770 |
PartialEq<iso8601::DateKind>, |
| 771 |
Copy, |
| 772 |
Eq, |
| 773 |
RefUnwindSafe, |
| 774 |
Send, |
| 775 |
Sync, |
| 776 |
Unpin, |
| 777 |
UnwindSafe, |
| 778 |
} |
| 779 |
assert_impl! { iso8601::FormattedComponents: |
| 780 |
Clone, |
| 781 |
Debug, |
| 782 |
PartialEq<iso8601::FormattedComponents>, |
| 783 |
Copy, |
| 784 |
Eq, |
| 785 |
RefUnwindSafe, |
| 786 |
Send, |
| 787 |
Sync, |
| 788 |
Unpin, |
| 789 |
UnwindSafe, |
| 790 |
} |
| 791 |
assert_impl! { iso8601::OffsetPrecision: |
| 792 |
Clone, |
| 793 |
Debug, |
| 794 |
PartialEq<iso8601::OffsetPrecision>, |
| 795 |
Copy, |
| 796 |
Eq, |
| 797 |
RefUnwindSafe, |
| 798 |
Send, |
| 799 |
Sync, |
| 800 |
Unpin, |
| 801 |
UnwindSafe, |
| 802 |
} |
| 803 |
assert_impl! { iso8601::TimePrecision: |
| 804 |
Clone, |
| 805 |
Debug, |
| 806 |
PartialEq<iso8601::TimePrecision>, |
| 807 |
Copy, |
| 808 |
Eq, |
| 809 |
RefUnwindSafe, |
| 810 |
Send, |
| 811 |
Sync, |
| 812 |
Unpin, |
| 813 |
UnwindSafe, |
| 814 |
} |
| 815 |
assert_impl! { Parsed: |
| 816 |
Clone, |
| 817 |
Debug, |
| 818 |
Copy, |
| 819 |
RefUnwindSafe, |
| 820 |
Send, |
| 821 |
Sync, |
| 822 |
Unpin, |
| 823 |
UnwindSafe, |
| 824 |
} |
| 825 |
assert_impl! { @'a; Month: |
| 826 |
Arbitrary, |
| 827 |
Clone, |
| 828 |
Debug, |
| 829 |
Deserialize<'a>, |
| 830 |
Display, |
| 831 |
Hash, |
| 832 |
PartialEq<Month>, |
| 833 |
TryFrom<u8, Error = error::ComponentRange>, |
| 834 |
Copy, |
| 835 |
Eq, |
| 836 |
RefUnwindSafe, |
| 837 |
Send, |
| 838 |
Sync, |
| 839 |
Unpin, |
| 840 |
UnwindSafe, |
| 841 |
} |
| 842 |
assert_impl! { @'a; Weekday: |
| 843 |
Arbitrary, |
| 844 |
Clone, |
| 845 |
Debug, |
| 846 |
Deserialize<'a>, |
| 847 |
Display, |
| 848 |
Hash, |
| 849 |
PartialEq<Weekday>, |
| 850 |
Serialize, |
| 851 |
Copy, |
| 852 |
Eq, |
| 853 |
RefUnwindSafe, |
| 854 |
Send, |
| 855 |
Sync, |
| 856 |
Unpin, |
| 857 |
UnwindSafe, |
| 858 |
} |
| 859 |
assert_impl! { Error: |
| 860 |
Debug, |
| 861 |
Display, |
| 862 |
StdError, |
| 863 |
From<error::ComponentRange>, |
| 864 |
From<error::ConversionRange>, |
| 865 |
From<error::DifferentVariant>, |
| 866 |
From<error::Format>, |
| 867 |
From<error::IndeterminateOffset>, |
| 868 |
From<error::InvalidFormatDescription>, |
| 869 |
From<error::Parse>, |
| 870 |
From<error::ParseFromDescription>, |
| 871 |
From<error::TryFromParsed>, |
| 872 |
Send, |
| 873 |
Sync, |
| 874 |
Unpin, |
| 875 |
} |
| 876 |
assert_impl! { error::Format: |
| 877 |
Debug, |
| 878 |
Display, |
| 879 |
StdError, |
| 880 |
From<std::io::Error>, |
| 881 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 882 |
Send, |
| 883 |
Sync, |
| 884 |
Unpin, |
| 885 |
} |
| 886 |
assert_impl! { error::InvalidFormatDescription: |
| 887 |
Clone, |
| 888 |
Debug, |
| 889 |
Display, |
| 890 |
StdError, |
| 891 |
PartialEq<error::InvalidFormatDescription>, |
| 892 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 893 |
Eq, |
| 894 |
RefUnwindSafe, |
| 895 |
Send, |
| 896 |
Sync, |
| 897 |
Unpin, |
| 898 |
UnwindSafe, |
| 899 |
} |
| 900 |
assert_impl! { error::Parse: |
| 901 |
Clone, |
| 902 |
Debug, |
| 903 |
Display, |
| 904 |
StdError, |
| 905 |
From<error::ParseFromDescription>, |
| 906 |
From<error::TryFromParsed>, |
| 907 |
PartialEq<error::Parse>, |
| 908 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 909 |
Copy, |
| 910 |
Eq, |
| 911 |
RefUnwindSafe, |
| 912 |
Send, |
| 913 |
Sync, |
| 914 |
Unpin, |
| 915 |
UnwindSafe, |
| 916 |
} |
| 917 |
assert_impl! { error::ParseFromDescription: |
| 918 |
Clone, |
| 919 |
Debug, |
| 920 |
Display, |
| 921 |
StdError, |
| 922 |
PartialEq<error::ParseFromDescription>, |
| 923 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 924 |
TryFrom<error::Parse, Error = error::DifferentVariant>, |
| 925 |
Copy, |
| 926 |
Eq, |
| 927 |
RefUnwindSafe, |
| 928 |
Send, |
| 929 |
Sync, |
| 930 |
Unpin, |
| 931 |
UnwindSafe, |
| 932 |
} |
| 933 |
assert_impl! { error::TryFromParsed: |
| 934 |
Clone, |
| 935 |
Debug, |
| 936 |
Display, |
| 937 |
StdError, |
| 938 |
From<error::ComponentRange>, |
| 939 |
PartialEq<error::TryFromParsed>, |
| 940 |
TryFrom<Error, Error = error::DifferentVariant>, |
| 941 |
TryFrom<error::Parse, Error = error::DifferentVariant>, |
| 942 |
Copy, |
| 943 |
Eq, |
| 944 |
RefUnwindSafe, |
| 945 |
Send, |
| 946 |
Sync, |
| 947 |
Unpin, |
| 948 |
UnwindSafe, |
| 949 |
} |
| 950 |
assert_impl! { @'a; Component: |
| 951 |
Clone, |
| 952 |
Debug, |
| 953 |
PartialEq<Component>, |
| 954 |
PartialEq<BorrowedFormatItem<'a>>, |
| 955 |
TryFrom<BorrowedFormatItem<'a>, Error = error::DifferentVariant>, |
| 956 |
Copy, |
| 957 |
Eq, |
| 958 |
RefUnwindSafe, |
| 959 |
Send, |
| 960 |
Sync, |
| 961 |
Unpin, |
| 962 |
UnwindSafe, |
| 963 |
} |
| 964 |
assert_impl! { @'a; BorrowedFormatItem<'_>: |
| 965 |
Clone, |
| 966 |
Debug, |
| 967 |
From<&'a [BorrowedFormatItem<'a>]>, |
| 968 |
From<Component>, |
| 969 |
PartialEq<&'a [BorrowedFormatItem<'a>]>, |
| 970 |
PartialEq<Component>, |
| 971 |
PartialEq<BorrowedFormatItem<'a>>, |
| 972 |
Eq, |
| 973 |
Formattable, |
| 974 |
Parsable, |
| 975 |
RefUnwindSafe, |
| 976 |
Send, |
| 977 |
Sync, |
| 978 |
Unpin, |
| 979 |
UnwindSafe, |
| 980 |
} |
| 981 |
assert_impl! { @'a; &[BorrowedFormatItem<'_>]: |
| 982 |
PartialEq<BorrowedFormatItem<'a>>, |
| 983 |
TryFrom<BorrowedFormatItem<'a>, Error = error::DifferentVariant>, |
| 984 |
} |
| 985 |
assert_impl! { modifier::MonthRepr: |
| 986 |
Clone, |
| 987 |
Debug, |
| 988 |
Default, |
| 989 |
PartialEq<modifier::MonthRepr>, |
| 990 |
Copy, |
| 991 |
Eq, |
| 992 |
RefUnwindSafe, |
| 993 |
Send, |
| 994 |
Sync, |
| 995 |
Unpin, |
| 996 |
UnwindSafe, |
| 997 |
} |
| 998 |
assert_impl! { modifier::Padding: |
| 999 |
Clone, |
| 1000 |
Debug, |
| 1001 |
Default, |
| 1002 |
PartialEq<modifier::Padding>, |
| 1003 |
Copy, |
| 1004 |
Eq, |
| 1005 |
RefUnwindSafe, |
| 1006 |
Send, |
| 1007 |
Sync, |
| 1008 |
Unpin, |
| 1009 |
UnwindSafe, |
| 1010 |
} |
| 1011 |
assert_impl! { modifier::SubsecondDigits: |
| 1012 |
Clone, |
| 1013 |
Debug, |
| 1014 |
Default, |
| 1015 |
PartialEq<modifier::SubsecondDigits>, |
| 1016 |
Copy, |
| 1017 |
Eq, |
| 1018 |
RefUnwindSafe, |
| 1019 |
Send, |
| 1020 |
Sync, |
| 1021 |
Unpin, |
| 1022 |
UnwindSafe, |
| 1023 |
} |
| 1024 |
assert_impl! { modifier::WeekNumberRepr: |
| 1025 |
Clone, |
| 1026 |
Debug, |
| 1027 |
Default, |
| 1028 |
PartialEq<modifier::WeekNumberRepr>, |
| 1029 |
Copy, |
| 1030 |
Eq, |
| 1031 |
RefUnwindSafe, |
| 1032 |
Send, |
| 1033 |
Sync, |
| 1034 |
Unpin, |
| 1035 |
UnwindSafe, |
| 1036 |
} |
| 1037 |
assert_impl! { modifier::WeekdayRepr: |
| 1038 |
Clone, |
| 1039 |
Debug, |
| 1040 |
Default, |
| 1041 |
PartialEq<modifier::WeekdayRepr>, |
| 1042 |
Copy, |
| 1043 |
Eq, |
| 1044 |
RefUnwindSafe, |
| 1045 |
Send, |
| 1046 |
Sync, |
| 1047 |
Unpin, |
| 1048 |
UnwindSafe, |
| 1049 |
} |
| 1050 |
assert_impl! { modifier::YearRepr: |
| 1051 |
Clone, |
| 1052 |
Debug, |
| 1053 |
Default, |
| 1054 |
PartialEq<modifier::YearRepr>, |
| 1055 |
Copy, |
| 1056 |
Eq, |
| 1057 |
RefUnwindSafe, |
| 1058 |
Send, |
| 1059 |
Sync, |
| 1060 |
Unpin, |
| 1061 |
UnwindSafe, |
| 1062 |
} |
| 1063 |
assert_impl! { StandardRand08: |
| 1064 |
DistributionRand08<Date>, |
| 1065 |
DistributionRand08<Duration>, |
| 1066 |
DistributionRand08<OffsetDateTime>, |
| 1067 |
DistributionRand08<UtcDateTime>, |
| 1068 |
DistributionRand08<PrimitiveDateTime>, |
| 1069 |
DistributionRand08<Time>, |
| 1070 |
DistributionRand08<UtcOffset>, |
| 1071 |
DistributionRand08<Month>, |
| 1072 |
DistributionRand08<Weekday>, |
| 1073 |
} |
| 1074 |
assert_impl! { StandardUniformRand09: |
| 1075 |
DistributionRand09<Date>, |
| 1076 |
DistributionRand09<Duration>, |
| 1077 |
DistributionRand09<OffsetDateTime>, |
| 1078 |
DistributionRand09<UtcDateTime>, |
| 1079 |
DistributionRand09<PrimitiveDateTime>, |
| 1080 |
DistributionRand09<Time>, |
| 1081 |
DistributionRand09<UtcOffset>, |
| 1082 |
DistributionRand09<Month>, |
| 1083 |
DistributionRand09<Weekday>, |
| 1084 |
} |
| 1085 |
assert_impl! { StdDuration: |
| 1086 |
Add<Duration, Output = Duration>, |
| 1087 |
AddAssign<Duration>, |
| 1088 |
Div<Duration, Output = f64>, |
| 1089 |
PartialEq<Duration>, |
| 1090 |
PartialOrd<Duration>, |
| 1091 |
Sub<Duration, Output = Duration>, |
| 1092 |
SubAssign<Duration>, |
| 1093 |
TryFrom<Duration>, |
| 1094 |
} |
| 1095 |
assert_impl! { #[expect(deprecated)] StdInstant: |
| 1096 |
Add<Duration, Output = StdInstant>, |
| 1097 |
AddAssign<Duration>, |
| 1098 |
Sub<Duration, Output = StdInstant>, |
| 1099 |
SubAssign<Duration>, |
| 1100 |
PartialEq<Instant>, |
| 1101 |
PartialOrd<Instant>, |
| 1102 |
From<Instant>, |
| 1103 |
Sub<Instant>, |
| 1104 |
} |
| 1105 |
assert_impl! { SystemTime: |
| 1106 |
Add<Duration, Output = SystemTime>, |
| 1107 |
AddAssign<Duration>, |
| 1108 |
Sub<Duration, Output = SystemTime>, |
| 1109 |
SubAssign<Duration>, |
| 1110 |
From<OffsetDateTime>, |
| 1111 |
PartialEq<OffsetDateTime>, |
| 1112 |
PartialOrd<OffsetDateTime>, |
| 1113 |
Sub<OffsetDateTime>, |
| 1114 |
} |
| 1115 |
assert_impl! { i8: |
| 1116 |
Mul<Duration>, |
| 1117 |
} |
| 1118 |
assert_impl! { i16: |
| 1119 |
Mul<Duration>, |
| 1120 |
} |
| 1121 |
assert_impl! { i32: |
| 1122 |
Mul<Duration>, |
| 1123 |
} |
| 1124 |
assert_impl! { u8: |
| 1125 |
Mul<Duration>, |
| 1126 |
From<Month>, |
| 1127 |
} |
| 1128 |
assert_impl! { u16: |
| 1129 |
Mul<Duration>, |
| 1130 |
} |
| 1131 |
assert_impl! { u32: |
| 1132 |
Mul<Duration>, |
| 1133 |
} |
| 1134 |
assert_impl! { f32: |
| 1135 |
Mul<Duration>, |
| 1136 |
} |
| 1137 |
assert_impl! { f64: |
| 1138 |
Mul<Duration>, |
| 1139 |
} |