Skip to content
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

Support unnamed flags #371

Merged
merged 8 commits into from Jul 14, 2023
Merged

Support unnamed flags #371

merged 8 commits into from Jul 14, 2023

Conversation

KodrAus
Copy link
Member

@KodrAus KodrAus commented Jul 3, 2023

This PR introduces the concept of unnamed flags. You can add an unnamed flag to your flags types like:

bitflags! {
    pub struct Flags: u8 {
        // regular, named flag
        const A = 1;

        // unnamed flag
        const _ = !0;
    }
}

Adding an unnamed flag means its bits will be part of the mask in from_bits_truncate, but it won't generate a constant, and it won't be given a name when formatting or parsing.

@KodrAus KodrAus marked this pull request as ready for review July 11, 2023 00:28
@KodrAus KodrAus changed the title Add a bitflags_external! macro for cases where bits are defined externally Support unnamed flags Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant