std: Don't require bitflags! be u32
If you didn't have a trailing comma at the end of the variants, you could use any type you wanted, but if you used a trailing comma the macro would erroneously require the bits be a u32.
This commit is contained in:
parent
af3889f697
commit
b54eb9b6e2
@ -223,7 +223,7 @@ macro_rules! bitflags {
|
|||||||
}) => {
|
}) => {
|
||||||
bitflags! {
|
bitflags! {
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
flags $BitFlags: u32 {
|
flags $BitFlags: $T {
|
||||||
$($(#[$Flag_attr])* static $Flag = $value),+
|
$($(#[$Flag_attr])* static $Flag = $value),+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,6 +255,12 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bitflags! {
|
||||||
|
flags AnotherSetOfFlags: uint {
|
||||||
|
static AnotherFlag = 1u,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_bits(){
|
fn test_bits(){
|
||||||
assert_eq!(Flags::empty().bits(), 0x00000000);
|
assert_eq!(Flags::empty().bits(), 0x00000000);
|
||||||
|
Loading…
Reference in New Issue
Block a user