-
Notifications
You must be signed in to change notification settings - Fork 160
Implement iterator for all named flags #465
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
Conversation
Add method to iterate over all named flags.
|
This PR will implement the issue #464 |
src/traits.rs
Outdated
| } | ||
|
|
||
| /// This method will return an iterator over all named flags (including combinations). | ||
| fn all_named_flags() -> impl Iterator<Item = Self> { |
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.
I think we should call this iter_named and move it down to under the iter function on line 217.
We'll also need to write a concrete implementation of the iterator like the other methods do so we don't need to bump our MSRV.
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.
finished
KodrAus
left a comment
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 working on this @ssrlive! We'll just need to make a few changes before we can merge this. We should also add a test to the suite here: https://github.com/bitflags/bitflags/tree/main/src/tests
|
Finished all the tasks. |
and add a test case test_iter_named
|
I have fixed the |
KodrAus
left a comment
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 working through this @ssrlive! This looks good to me.
| "Should have 5 composite flags (D, ABC, AB, AC, CB)" | ||
| ); | ||
|
|
||
| println!("All iter_named() tests passed!"); |
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.
I think we can remove these additional cases since they're just exercising iterator infrastructure from the standard library and aren't actually asserting on anything, but I'll do that in a follow-up.
|
Please publish a new version sooner. |
Add method to iterate over all named flags.
This test suit passed successfully
The output is