Skip to content

Feature request: Support bitflags #863

@simonask

Description

@simonask

The bitflags crate is really pervasive in Rust code.

It would be nice to be able to support #[derive(Facet)] inside bitflags! { ... } somehow, but if that isn't possible it might be necessary to introduce either a facet_bitflags! { ... } macro wrapper, or a FacetBitflags alternative derive macro. Are there other good options, short of actually patching bitflags to support facet?

Behavior: Bitflags are a bit like enums and a bit like sets. It would be important to support operations like contains(...) -> bool, intersects(...) -> bool, and union(...) -> Self in the vtable. Raw access to the bits would also be nice.

For serialization, I would expect bitflags to serialize as "list of enum variants" in high-level/human-readable formats and as the raw bitmask in low-level binary formats.

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