Add a method to get the unknown bits from a flags value #442
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#442
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?
I recommend to provide the following API to users:
Usually, when we found the unknown bits, we want to report them.
@FuuuOverclocking can you further clarify why the already provided
contains_unknown_bitsis not enough for you or what additions (bail!macro?) you want.Hi RS! We've noticed a common need: when a function gets some unknown bits passed in, it wants to tell users exactly which bits aren't supported in this version, making the problem clear. While contains_unknown_bits can tell us that there are unknown bits in there, it can't tell us which ones. That's why we think adding an
unknown_bits()method would be really helpful. Once we haveunknown_bits(), we can actually implementcontains_unknown_bitsas!unknown_bits().empty(), making it a combination of basic methods.By the way,
bail!is an anyhow macro that's used for returning errors.I think a pair of methods on the
Flagstrait that complement the existingbitsmethod would be ok here:I'd be in favour of a PR that added those in 👍