Generate an enum #449
Labels
No labels
bug
good first issue
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-bitflags/bitflags#449
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Statically having an enum for unique flags would be super useful. As the main benefit, you could match on them like normal.
Contiguous power-of-two flags could also be represented by their binary logarithms. Here's some choices for the integer primitive:
trailing_zerosreturn typeAs an example of how this would make lookup tables easy, compare the following code blocks:
Edit: I just found the
enumflags2crate, but I want to see how this is responded toHi @axelkar 👋 Thanks for the suggestion! This is something that would be out-of-scope for
bitflagsto support natively, since it doesn't just deal with flags where a single bit uniquely corresponds to a single flag that could be made into anenumvariant.