From 763228c859d15c9608e9f954c8ebd7c2ae091daf Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Wed, 13 Mar 2019 14:39:51 +0100 Subject: [PATCH] Create a generic `BootInfoFrameAllocator` type --- src/memory.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/memory.rs b/src/memory.rs index 1e9dd9bf..6bd52009 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -63,3 +63,19 @@ impl FrameAllocator for EmptyFrameAllocator { None } } + +pub struct BootInfoFrameAllocator +where + I: Iterator, +{ + frames: I, +} + +impl FrameAllocator for BootInfoFrameAllocator +where + I: Iterator, +{ + fn allocate_frame(&mut self) -> Option { + self.frames.next() + } +}