enumflags2
enumflags2 copied to clipboard
Rust library for typesystem-assisted bitflags.
Here's a thought, something that happens often in practice: you're deserializing something that looks like ```json {"flags": ["foo", "baz"]} ``` into your own bitflags format which looks like ```rust enum...
The only thing I'd change about this library is the way const fn support is handled — once const fn traits get stabilized, I'll be able to remove a lot...
As implemented, comparison between BitFlags is not the same as `contains` and depends on the bit assigned to each variant (explicitly or implicitly via the ordering of the variants). This...
Some small fixes regarding formatting
enumflags2 uses FromBitsError for the error for TryFrom, but the struct doesnt implement std::error::Error which makes it unwieldy to use, for example with the `?` operator or a diagnostics package...
Macro can not find enumflags2 crate if enumflags2 is reexported (pub use). A lot of projects use one main crate to organize all crates that all crates in workspace may...
For `BitFlags` converting to `N` with `bits()` is infallible. Thus, it need not be a `try_from()` and instead just `from()` where the impl is just `bits()`. A user can't do...
Happens when using glob import `use enumflags2::*`
Constants of type `BitFlags` cannot be used as a pattern in match expressions because it has manually implemented `PartialEq` trait. To be able to use constants of a type in...
I was looking for a way to compactly represent a set of enums in a project, and for a second i thought this crate was exactly what i needed, but...