Macro macro_bits::bit
source · macro_rules! bit { ($index:expr) => { ... }; ($($index:expr), +) => { ... }; }
Expand description
Generate a mask from one or more bit indices.
use macro_bits::bit;
const SINGLE_BIT: u8 = bit!(0);
const MULTIPLE_BITS: u8 = bit!(1,2);
assert_eq!(SINGLE_BIT, 1);
assert_eq!(MULTIPLE_BITS, 6);