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
Generate an enum with one variant for each unit, use that for iteration. #215
Conversation
This indeed much simpler than doing tricks with |
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.
Thanks for the PR!
I think I've fixed everything. |
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.
Couple more minor changes. I think the code looks good so far but I have only reviewed through github. I want to do one more review, hopefully this weekend, with the compiler then I think we'll be able to merge.
- Remove inline on units() - Move and rename unit test.
I haven't forgotten about this, I just didn't finish my review this weekend. I like using |
Merged! Thanks so much for the PR and sorry for the delays. My quest to use the user-provided documentation on the |
This extends the
quantity!
macro to generate a non-exhaustive enum with one variant per unit. A static slice of the different potential values of this enum is also generated, which is exposed publicly through aunits()
function, which returns an iterator. This can be used to iterate over the different units.