flagset
flagset copied to clipboard
[Bug]: Implicit value not starting at 1
Is there an existing issue for this?
- [x] I have searched the existing issues
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Current Behaviour
sets variant values starting at 0
Expected Behaviour
set variants starting at 1
Environment Information
rust: rustc 1.89.0
linux: Linux pc 6.16.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 15 Aug 2025 16:04:43 +0000 x86_64 GNU/Linux
flagset: 0.4.7 with no features
Steps To Reproduce
This code fails when expecting the variant A to be 1.
use flagset::flags;
fn main() {
let f = Flag::A;
assert_eq!(f as u64, 1); // This fails.
}
flags! {
enum Flag: u64 {
A, // should be 0b001 but is 0b000
B // should be 0b002 but is 0b001
}
}