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

.month() should return chrono::Month #727

Open
Chris00 opened this issue Jul 5, 2022 · 3 comments
Open

.month() should return chrono::Month #727

Chris00 opened this issue Jul 5, 2022 · 3 comments
Labels
API-incompatible Tracking changes that need incompatible API revisions

Comments

@Chris00
Copy link

Chris00 commented Jul 5, 2022

Thanks for your useful library. I was wondering why doesn't .month() return chrono::Month which can be cast to an integer if desired. To give the same result as now, Month would need to be declared as

pub enum Month {
    January = 1,
    February = 2,
    March = 3,
 ...
@djc djc added the API-incompatible Tracking changes that need incompatible API revisions label Jul 6, 2022
@djc
Copy link
Member

djc commented Jul 6, 2022

Seems like an interesting idea. It would of course change the API in an incompatible way. I also think we might chose to expose the number as a method instead of relying on the integer cast?

@Chris00
Copy link
Author

Chris00 commented Jul 6, 2022

It would of course change the API in an incompatible way.

Sure. That would be for version 0.5.0. 😀

we might chose to expose the number as a method instead of relying on the integer cast?

Yes but you would need one method per integer type (.as_u8(), .as_u32(),...) while the cast takes care of that for you. The possibility to cast may be mentioned in the documentation to ease the transition.

@djc
Copy link
Member

djc commented Jul 6, 2022

I think we would only provide as_u8() and leave casting it up to the user, that seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API-incompatible Tracking changes that need incompatible API revisions
Projects
None yet
Development

No branches or pull requests

2 participants