Skip to content

Support unnamed flags #371

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

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.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy