-
Notifications
You must be signed in to change notification settings - Fork 160
Closed
Description
In the example, Flags::A | Flags::B pattern is used to print "A and/or B are set", but that pattern does not actually do that. It only matches A and B. The following code, which is a slightly modified code from the example itself, panics when trying to match Flags::A
use bitflags::{bitflags, bitflags_match};
bitflags! {
#[derive(PartialEq)]
struct Flags: u8 {
const A = 1 << 0;
const B = 1 << 1;
const C = 1 << 2;
}
}
let flags = Flags::A; // Flags::A | Flags::B in the example
bitflags_match!(flags, {
Flags::A | Flags::B => println!("A and/or B are set"),
_ => panic!("neither A nor B are set"), // println in the example
})Metadata
Metadata
Assignees
Labels
No labels