We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
BitFlags<MyFlags>
Because the BitFlags type comes from the enumflags2 crate, we can not add our own impl blocks for it or impl traits for it.
BitFlags
enumflags2
impl
Would you be interested in an additional macro that allows you to define your own BitFlags type for a specific BitFlag enum?
BitFlag
#[bitflags] #[repr(u8)] #[derive(Copy, Clone, Debug, PartialEq)] enum Flags { A = 0b0001, B = 0b0010, C, // unspecified variants pick unused bits automatically D = 0b1000, } #[flagset(Flags)] struct Status; // Yaay, we can do this: impl Status { pub fn priority(&self) -> u8 { if self.contains(Flags::A) { 1 } else { 2 } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Because the
BitFlags
type comes from theenumflags2
crate, we can not add our ownimpl
blocks for it or impl traits for it.Would you be interested in an additional macro that allows you to define your own
BitFlags
type for a specificBitFlag
enum?The text was updated successfully, but these errors were encountered: