-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement PartialOrd for DateTime #10
Conversation
src/lib.rs
Outdated
@@ -794,7 +794,7 @@ impl UtcDateTime { | |||
} | |||
|
|||
/// Date time associated to a local time type, exprimed in the [proleptic gregorian calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar) | |||
#[derive(Debug, Clone, Eq, PartialEq)] | |||
#[derive(Debug, Clone, Eq)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eq
cannot be derived and must be implemented manually since it is not applicable to all fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eq is more of a marker, having an empty body, but I made the implementation explicit.
Create a new function used in tests for comparing fn check_equal_date_time(x: &DateTime, y: &DateTime) {
assert_eq!(x.second, y.second);
assert_eq!(x.minute, y.minute);
assert_eq!(x.hour, y.hour);
assert_eq!(x.month_day, y.month_day);
assert_eq!(x.month, y.month);
assert_eq!(x.year, y.year);
assert_eq!(x.week_day, y.week_day);
assert_eq!(x.year_day, y.year_day);
assert_eq!(x.local_time_type, y.local_time_type);
assert_eq!(x.unix_time, y.unix_time);
} |
Done. |
A better implementation is to remove the |
Closed in c4d7db5. |
No description provided.