Skip to content

Commit 3476955

Browse files
committed
multiboot2: custom Debug impl for efi_memory_map
It makes no sense to print the raw buffer. This is long and has less value.
1 parent 5194989 commit 3476955

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

multiboot2/src/memory_map.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl AsBytes for EFIMemoryDesc {}
284284

285285
/// EFI memory map tag. The embedded [`EFIMemoryDesc`]s follows the EFI
286286
/// specification.
287-
#[derive(ptr_meta::Pointee, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
287+
#[derive(ptr_meta::Pointee, PartialEq, Eq, PartialOrd, Ord, Hash)]
288288
#[repr(C)]
289289
pub struct EFIMemoryMapTag {
290290
typ: TagTypeId,
@@ -377,6 +377,19 @@ impl EFIMemoryMapTag {
377377
}
378378
}
379379

380+
impl Debug for EFIMemoryMapTag {
381+
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
382+
f.debug_struct("EFIMemoryMapTag")
383+
.field("typ", &self.typ)
384+
.field("size", &self.size)
385+
.field("desc_size", &self.desc_size)
386+
.field("buf", &self.memory_map.as_ptr())
387+
.field("buf_len", &self.memory_map.len())
388+
.field("entries", &self.memory_areas().len())
389+
.finish()
390+
}
391+
}
392+
380393
impl TagTrait for EFIMemoryMapTag {
381394
const ID: TagType = TagType::EfiMmap;
382395

0 commit comments

Comments
 (0)