Expand description
§BitmapAllocator
Bit allocator based on segment tree algorithm.
§Example
use bitmap_allocator::{BitAlloc, BitAlloc1M};
let mut ba = BitAlloc1M::default();
ba.insert(0..16);
for i in 0..16 {
assert!(ba.test(i));
}
ba.remove(2..8);
assert_eq!(ba.alloc(), Some(0));
assert_eq!(ba.alloc(), Some(1));
assert_eq!(ba.alloc(), Some(8));
ba.dealloc(0);
ba.dealloc(1);
ba.dealloc(8);
Structs§
- BitAlloc16
- A bitmap consisting of only 16 bits. BitAlloc16 acts as the leaf (except the leaf bits of course) nodes in the segment trees.
- BitAlloc
Cascade16 - Implement the bit allocator by segment tree algorithm.
Traits§
- BitAlloc
- Allocator of a bitmap, able to allocate / free bits.
Type Aliases§
- BitAlloc1M
- A bitmap of 1M bits
- BitAlloc4K
- A bitmap of 4K bits
- BitAlloc16M
- A bitmap of 16M bits
- BitAlloc64K
- A bitmap of 64K bits
- BitAlloc256
- A bitmap of 256 bits
- BitAlloc256M
- A bitmap of 256M bits