Skip to content

Commit 616ccc5

Browse files
Spartan2909IsaacWoods
authored andcommitted
Add Debug impl for PhysicalMapping even when T is not Debug
1 parent a8bf262 commit 616ccc5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

acpi/src/handler.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
use core::{ops::Deref, ptr::NonNull};
1+
use core::{fmt, ops::Deref, ptr::NonNull};
22

33
/// Describes a physical mapping created by `AcpiHandler::map_physical_region` and unmapped by
44
/// `AcpiHandler::unmap_physical_region`. The region mapped must be at least `size_of::<T>()`
55
/// bytes, but may be bigger.
66
///
77
/// See `PhysicalMapping::new` for the meaning of each field.
8-
#[derive(Debug)]
98
pub struct PhysicalMapping<H, T>
109
where
1110
H: AcpiHandler,
@@ -17,6 +16,21 @@ where
1716
handler: H,
1817
}
1918

19+
impl<H, T> fmt::Debug for PhysicalMapping<H, T>
20+
where
21+
H: AcpiHandler + fmt::Debug,
22+
{
23+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24+
f.debug_struct("PhysicalMapping")
25+
.field("physical_start", &self.physical_start)
26+
.field("virtual_start", &self.virtual_start)
27+
.field("region_length", &self.region_length)
28+
.field("mapped_length", &self.mapped_length)
29+
.field("handler", &self.handler)
30+
.finish()
31+
}
32+
}
33+
2034
impl<H, T> PhysicalMapping<H, T>
2135
where
2236
H: AcpiHandler,

0 commit comments

Comments
 (0)