ros666::mm::frame_allocator

Trait FrameAllocator

Source
trait FrameAllocator {
    // Required methods
    fn new() -> Self;
    fn alloc(&mut self) -> Option<PhysicalPageNumber>;
    fn dealloc(&mut self, frame: PhysicalPageNumber);
}
Expand description

帧分配器

帧分配器需要实现 FrameAllocator trait,提供分配和释放物理页帧的功能。

Required Methods§

Source

fn new() -> Self

创建一个新的帧分配器实例。

§返回值

返回一个新的 FrameAllocator 实例。

Source

fn alloc(&mut self) -> Option<PhysicalPageNumber>

分配一个物理页帧。

§返回值

如果成功,返回一个 PhysicalPageNumber,否则返回 None。

Source

fn dealloc(&mut self, frame: PhysicalPageNumber)

释放一个物理页帧。

§参数
  • frame - 要释放的物理页帧。

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.

Implementors§