pub unsafe trait PageAlloc {
// Required methods
fn alloc_page(&self, size: usize) -> Result<NonNull<[u8]>, AllocError>;
unsafe fn dealloc_page(&self, page: NonNull<[u8]>);
}Expand description
§Safety
moving an implementation of this trait shouldn’t invalidate currently allocated pages.
Required Methods§
Sourcefn alloc_page(&self, size: usize) -> Result<NonNull<[u8]>, AllocError>
fn alloc_page(&self, size: usize) -> Result<NonNull<[u8]>, AllocError>
Returns a pointer aligned to at least 4KB
Sourceunsafe fn dealloc_page(&self, page: NonNull<[u8]>)
unsafe fn dealloc_page(&self, page: NonNull<[u8]>)
§Safety
page has to be a currently allocated page from this instance of PageAlloc