trait Allocator<const N: usize> {
// Required methods
fn initializer( ) -> unsafe fn(PhysAddr, usize) -> Result<Pin<Box<Self>>, Error>;
fn alloc(&mut self, page_count: usize) -> Option<PhysAddr>;
fn free(&mut self, addr: PhysAddr, page_count: usize);
}Expand description
This trait abstracts over different page frame allocator implementations.
Required Methods§
Sourcefn initializer() -> unsafe fn(PhysAddr, usize) -> Result<Pin<Box<Self>>, Error>
fn initializer() -> unsafe fn(PhysAddr, usize) -> Result<Pin<Box<Self>>, Error>
Returns an initializer function that can be used to create an instance of the allocator. The initializer function takes a physical address and the amount of pages needed.
Safety:
- The returned function must only be called with a useable and valid physical address.
fn alloc(&mut self, page_count: usize) -> Option<PhysAddr>
fn free(&mut self, addr: PhysAddr, page_count: usize)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.