1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! A minimal, fixed-size bitmap library written in pure Rust.
//! `no_std`, no heap / `alloc`, no `unsafe` — just `core`.
//!
//! Designed for use in embedded and resource-constrained environments.
//!
//! [`BitMap`] is the main struct in this library. Its [features](#features)
//! are listed below.
//!
//! # Examples
//! ```
//! use light_bitmap::{bucket_count, BitMap};
//!
//! const BIT_COUNT: usize = 10;
//! let mut bitmap = BitMap::<BIT_COUNT, { bucket_count(BIT_COUNT) }>::new();
//! assert_eq!(bitmap.popcount(), 0);
//! assert!(!bitmap.is_set(3));
//! bitmap.set(3);
//! assert!(bitmap.is_set(3));
//! assert_eq!(bitmap.popcount(), 1);
//! ```
//!
//! # Use Cases
//!
//! - Embedded development
//! - Applications that need a compact, stack-only bitmap with no dynamic allocation
//! - Timing-sensitive systems where allocation unpredictability must be avoided
//! - Does not support SIMD or parallel execution, so it's not ideal for cases
//! where performance needs to be fully maxed out
//!
//! # Features
//!
//! - `#![no_std]` compatible
//! - Bit-level operations on a fixed number of bits
//! - No heap allocations (stack-only)
//! - Const-generic API: `BitMap<const BIT_COUNT, const BUCKET_COUNT>`
//! - Efficient iteration over all, set or unset bits:
//! - `iter()` (all bits as bools)
//! - `iter_ones()` (indices of set bits)
//! - `iter_zeros()` (indices of unset bits)
//! - Support for bitwise ops:
//! - `&`, `|`, `^`, `!`
//! - `<<`, `>>`
//! - `&=`, `|=`, `^=`, `<<=`, `>>=`
//! - Range operations: `set_range`, `unset_range`
//! - Logical operations: `popcount`, `first_set_bit`
//! - Rotation support: `rotate_left`, `rotate_right`
pub use ;