Trait allocator::PageAllocator
source · pub trait PageAllocator: BaseAllocator {
const PAGE_SIZE: usize;
// Required methods
fn alloc_pages(
&mut self,
num_pages: usize,
align_pow2: usize
) -> AllocResult<usize>;
fn dealloc_pages(&mut self, pos: usize, num_pages: usize);
fn total_pages(&self) -> usize;
fn used_pages(&self) -> usize;
fn available_pages(&self) -> usize;
}
Expand description
Page-granularity allocator.
Required Associated Constants§
Required Methods§
sourcefn alloc_pages(
&mut self,
num_pages: usize,
align_pow2: usize
) -> AllocResult<usize>
fn alloc_pages( &mut self, num_pages: usize, align_pow2: usize ) -> AllocResult<usize>
Allocate contiguous memory pages with given count and alignment.
sourcefn dealloc_pages(&mut self, pos: usize, num_pages: usize)
fn dealloc_pages(&mut self, pos: usize, num_pages: usize)
Deallocate contiguous memory pages with given position and count.
sourcefn total_pages(&self) -> usize
fn total_pages(&self) -> usize
Returns the total number of memory pages.
sourcefn used_pages(&self) -> usize
fn used_pages(&self) -> usize
Returns the number of allocated memory pages.
sourcefn available_pages(&self) -> usize
fn available_pages(&self) -> usize
Returns the number of available memory pages.
Object Safety§
This trait is not object safe.