Skip to content
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

Make methods on DateTime const where possible #1400

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

pitdicker
Copy link
Collaborator

Since rust 1.61 it is possible to make these methods const.

In theory we should be careful with making methods on DateTime const. If we discover a method need to change and use something from the TimeZone trait it can no longer be const, which would be a breaking change.

But all the methods that can be made const in this PR clearly operate on UTC values, or return just a field of the DateTime type.

This completes the work to make the API const were possible 🎉.

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (fd66791) 91.84% compared to head (7c986bb) 91.84%.

Files Patch % Lines
src/datetime/mod.rs 85.71% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1400   +/-   ##
=======================================
  Coverage   91.84%   91.84%           
=======================================
  Files          38       38           
  Lines       17519    17518    -1     
=======================================
  Hits        16090    16090           
+ Misses       1429     1428    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pitdicker
Copy link
Collaborator Author

@djc Thank you for all the reviews the last days!

@pitdicker pitdicker merged commit 6f06e1a into chronotope:main Feb 2, 2024
36 of 37 checks passed
@pitdicker pitdicker deleted the const_datetime branch February 2, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants