Trait bitmap_allocator::BitAlloc
source · pub trait BitAlloc: Default {
const CAP: usize;
const DEFAULT: Self;
// Required methods
fn alloc(&mut self) -> Option<usize>;
fn alloc_contiguous(
&mut self,
size: usize,
align_log2: usize,
) -> Option<usize>;
fn next(&self, key: usize) -> Option<usize>;
fn dealloc(&mut self, key: usize);
fn insert(&mut self, range: Range<usize>);
fn remove(&mut self, range: Range<usize>);
fn any(&self) -> bool;
fn is_empty(&self) -> bool;
fn test(&self, key: usize) -> bool;
}
Expand description
Allocator of a bitmap, able to allocate / free bits.
Required Associated Constants§
Required Methods§
sourcefn alloc_contiguous(&mut self, size: usize, align_log2: usize) -> Option<usize>
fn alloc_contiguous(&mut self, size: usize, align_log2: usize) -> Option<usize>
Allocate a free block with a given size, and return the first bit position.
sourcefn next(&self, key: usize) -> Option<usize>
fn next(&self, key: usize) -> Option<usize>
Find a index not less than a given key, where the bit is free.
Object Safety§
This trait is not object safe.