-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add const on some functions #22
Conversation
4a2353d
to
a423ebc
Compare
If you move the |
I know for nushell it doesn't matter as much as we are pretty aggressive in that regard but do we want to commit to a certain minimum supported Rust version? Then I am not fully up to speed how far we can go with constification without precluding certain users. |
I can revert some const functions if needed. For example, to not enforce a specific rust version, I can remove the const keywords when the saturating functions are involved, and so on. What your thoughts on that? I can suggest two approaches for now:
|
At a certain point, my initial assumption was: most of the API exposed by this crate could be const. Since there is no a strong logic in there. And I was thinking that enforcing this trait could make sense for the end users. Anyway, you’re right about the no usage of a rust version as of today. Just let me know, what would you prefer. |
I've tested the PR with |
Thanks for investigating that! For the stuff I am doing both would be fine. |
So, what's next @sholderbach? Should I enforce the usage of the Rust version in cargo.toml without doing any further modifications? About your comment @nickelc, bevy did already that in their latest release (https://bevyengine.org/news/bevy-0-10/#const-bevy-ui-defaults). It could enable the usage of |
a423ebc
to
21e916e
Compare
I just rebased this PR on main, and I added the field |
21e916e
to
92c881b
Compare
@fdncred I don't know what is the current strategy regarding const functions. At least, the MSRV now announced is 1.62.1 with #30. There is no more blocker regarding adding those const keywords. But I'm open to any discussion. I could reduce the set of APIs using const, or we can even close it if this is not the right time ! |
As we already bumped the MSRV for that default syntactic sugar we can go ahead with this constification. |
Constify some functions, in order to use them in const context for other crates.