From 3e59283c1994f9a4a8135450c9ae35521b5a6514 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Wed, 13 Mar 2019 14:30:13 +0100 Subject: [PATCH] Create an `EmptyFrameAllocator` --- src/memory.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/memory.rs b/src/memory.rs index 5f40ff97..1e9dd9bf 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -54,3 +54,12 @@ pub fn create_example_mapping( let map_to_result = unsafe { mapper.map_to(page, frame, flags, frame_allocator) }; map_to_result.expect("map_to failed").flush(); } + +/// A FrameAllocator that always returns `None`. +pub struct EmptyFrameAllocator; + +impl FrameAllocator for EmptyFrameAllocator { + fn allocate_frame(&mut self) -> Option { + None + } +}