-
-
Notifications
You must be signed in to change notification settings - Fork 76
Description
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.