Skip to content

Feature request: Add a method such as all_named_flags #464

@ssrlive

Description

@ssrlive

Hi @KodrAus , can you please add a method such as all_named_flags to list all user defined variables? like this

    use bitflags::bitflags;

    bitflags! {
        #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
        struct Flags: u32 {
            const A = 0b00000001;
            const B = 0b00000010;
            const C = 0b00000100;
            const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();
        }
    }

    for flag in Flags::all_named_flags().iter() {
        println!("{:?}", flag);
    }

I expect the output is

Flags(A)
Flags(B)
Flags(C)
Flags(ABC)

Can you consider this suggestion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions