Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit ea4c011

Browse files
committed
Improve Debug impl for Variant
1 parent 51f2c04 commit ea4c011

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/variant.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ unsafe impl Sync for Variant { }
138138

139139
impl fmt::Debug for Variant {
140140
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
141-
f.write_fmt(format_args!("Variant {{ ptr: {:?}, type: \"{}\", value: {} }}",
142-
self.to_glib_none().0, self.type_(), self))
141+
f.debug_struct("Variant")
142+
.field("ptr", &self.to_glib_none().0)
143+
.field("type", &self.type_())
144+
.field("value", &self.to_string())
145+
.finish()
143146
}
144147
}
145148

0 commit comments

Comments
 (0)