Next Generation WASM Microkernel Operating System

chore: implement debug for BootstrapAllocator

+14 -1
+14 -1
libs/kmem/src/bootstrap/frame_allocator.rs
··· 1 1 use core::alloc::Layout; 2 + use core::fmt; 2 3 use core::num::NonZeroUsize; 3 4 use core::ops::Range; 4 - 5 5 use arrayvec::ArrayVec; 6 6 use lock_api::Mutex; 7 7 ··· 19 19 page_size: usize, 20 20 } 21 21 22 + #[derive(Debug)] 22 23 struct BootstrapAllocatorInner<const MAX_REGIONS: usize> { 23 24 regions: ArrayVec<Range<PhysicalAddress>, MAX_REGIONS>, 24 25 // offset from the top of memory regions 25 26 offset: usize, 27 + } 28 + 29 + impl<R, const MAX_REGIONS: usize> fmt::Debug for BootstrapAllocator<R, MAX_REGIONS> 30 + where 31 + R: lock_api::RawMutex, 32 + { 33 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 34 + f.debug_struct("BootstrapAllocator") 35 + .field("regions", &self.inner.lock()) 36 + .field("page_size", &self.page_size) 37 + .finish() 38 + } 26 39 } 27 40 28 41 impl<R, const MAX_REGIONS: usize> BootstrapAllocator<R, MAX_REGIONS>