macro_rules! bitmap {
() => { ... };
($($bit:expr),+ $(,)?) => { ... };
}Expand description
Creates a SmolBitmap from a list of bit positions.
This macro takes a comma-separated list of usize values representing
bit positions to set. It automatically determines the required capacity
based on the maximum bit position and creates an appropriately sized
bitmap.
ยงExamples
use smol_bitmap::{SmolBitmap, bitmap};
// Create a bitmap with bits 1, 5, and 10 set
let bmp = bitmap![1, 5, 10];
assert!(bmp.get(1));
assert!(bmp.get(5));
assert!(bmp.get(10));
assert!(!bmp.get(0));
assert!(!bmp.get(3));
// Empty bitmap
let empty = bitmap![];
assert_eq!(empty.capacity(), SmolBitmap::inline_capacity());
// Large bit positions automatically allocate heap storage
let large = bitmap![100, 200, 300];
assert!(large.get(100));
assert!(large.get(200));
assert!(large.get(300));