-
Notifications
You must be signed in to change notification settings - Fork 187
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 Ord
on aws_smithy_types::date_time::DateTime
#2406
Comments
1 task
david-perez
pushed a commit
that referenced
this issue
May 18, 2023
## Motivation and Context This change will allow easy sorting or comparing anything that contains a DateTime. My example is wanting to sort a list of S3 objects by last modified. This PR fixes #2406 ## Description It's a pretty small PR, it implements the `Ord` trait for `DateTime` by comparing the `seconds` property of `self` and `other`, if they are equal it compares the `subsec_nanos` properties instead. The `PartialOrd` trait is implemented by calling the `Ord` trait. ## Testing I added a unit test that compares a number of `DateTime` values with different combinations of positive/zero/negative `seconds`/`subsec_nanos`. ## Checklist - [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
david-perez
pushed a commit
that referenced
this issue
May 22, 2023
## Motivation and Context This change will allow easy sorting or comparing anything that contains a DateTime. My example is wanting to sort a list of S3 objects by last modified. This PR fixes #2406 ## Description It's a pretty small PR, it implements the `Ord` trait for `DateTime` by comparing the `seconds` property of `self` and `other`, if they are equal it compares the `subsec_nanos` properties instead. The `PartialOrd` trait is implemented by calling the `Ord` trait. ## Testing I added a unit test that compares a number of `DateTime` values with different combinations of positive/zero/negative `seconds`/`subsec_nanos`. ## Checklist - [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
david-perez
pushed a commit
that referenced
this issue
May 22, 2023
## Motivation and Context This change will allow easy sorting or comparing anything that contains a DateTime. My example is wanting to sort a list of S3 objects by last modified. This PR fixes #2406 ## Description It's a pretty small PR, it implements the `Ord` trait for `DateTime` by comparing the `seconds` property of `self` and `other`, if they are equal it compares the `subsec_nanos` properties instead. The `PartialOrd` trait is implemented by calling the `Ord` trait. ## Testing I added a unit test that compares a number of `DateTime` values with different combinations of positive/zero/negative `seconds`/`subsec_nanos`. ## Checklist - [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.rs/aws-smithy-types/latest/aws_smithy_types/date_time/struct.DateTime.html
The text was updated successfully, but these errors were encountered: