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§

source

const PAGE_SIZE: usize

The size of a memory page.

Required Methods§

source

fn alloc_pages( &mut self, num_pages: usize, align_pow2: usize ) -> AllocResult<usize>

Allocate contiguous memory pages with given count and alignment.

source

fn dealloc_pages(&mut self, pos: usize, num_pages: usize)

Deallocate contiguous memory pages with given position and count.

source

fn total_pages(&self) -> usize

Returns the total number of memory pages.

source

fn used_pages(&self) -> usize

Returns the number of allocated memory pages.

source

fn available_pages(&self) -> usize

Returns the number of available memory pages.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<const PAGE_SIZE: usize> PageAllocator for BitmapPageAllocator<PAGE_SIZE>

source§

const PAGE_SIZE: usize = PAGE_SIZE