We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Formatter::debug_struct()
Debug
1 parent 5508583 commit ee8187aCopy full SHA for ee8187a
library/core/src/fmt/mod.rs
@@ -2770,11 +2770,10 @@ impl<T: ?Sized> Pointer for *const T {
2770
if core::mem::size_of::<<T as core::ptr::Pointee>::Metadata>() == 0 {
2771
pointer_fmt_inner(self.expose_provenance(), f)
2772
} else {
2773
- f.write_str("Pointer { addr: ")?;
2774
- pointer_fmt_inner(self.expose_provenance(), f)?;
2775
- f.write_str(", metadata: ")?;
2776
- Debug::fmt(&core::ptr::metadata(*self), f)?;
2777
- f.write_str(" }")
+ f.debug_struct("Pointer")
+ .field_with("addr", |f| pointer_fmt_inner(self.expose_provenance(), f))
+ .field("metadata", &core::ptr::metadata(*self))
+ .finish()
2778
}
2779
2780
0 commit comments