diff --git a/src/allocator/frame/mod.rs b/src/allocator/frame/mod.rs index 5b6898a236..99c9d3215c 100644 --- a/src/allocator/frame/mod.rs +++ b/src/allocator/frame/mod.rs @@ -20,6 +20,7 @@ impl FrameCount { } } +#[derive(Debug)] pub struct FrameUsage { used: FrameCount, total: FrameCount, @@ -58,3 +59,21 @@ pub trait FrameAllocator { unsafe fn usage(&self) -> FrameUsage; } + +impl FrameAllocator for &mut T where T: FrameAllocator { + unsafe fn allocate(&mut self, count: FrameCount) -> Option { + T::allocate(self, count) + } + unsafe fn free(&mut self, address: PhysicalAddress, count: FrameCount) { + T::free(self, address, count) + } + unsafe fn allocate_one(&mut self) -> Option { + T::allocate_one(self) + } + unsafe fn free_one(&mut self, address: PhysicalAddress) { + T::free_one(self, address) + } + unsafe fn usage(&self) -> FrameUsage { + T::usage(self) + } +}