Create a generic BootInfoFrameAllocator type

This commit is contained in:
Philipp Oppermann
2019-03-13 14:39:51 +01:00
parent 770af27d75
commit 763228c859

View File

@@ -63,3 +63,19 @@ impl FrameAllocator<Size4KiB> for EmptyFrameAllocator {
None None
} }
} }
pub struct BootInfoFrameAllocator<I>
where
I: Iterator<Item = PhysFrame>,
{
frames: I,
}
impl<I> FrameAllocator<Size4KiB> for BootInfoFrameAllocator<I>
where
I: Iterator<Item = PhysFrame>,
{
fn allocate_frame(&mut self) -> Option<PhysFrame> {
self.frames.next()
}
}