Skip to content

Commit 7e05419

Browse files
committed
Implement fmt::Debug for Socket directly
1 parent 812bceb commit 7e05419

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/socket.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,11 @@ impl<'a> Write for &'a Socket {
970970

971971
impl fmt::Debug for Socket {
972972
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
973-
self.inner().fmt(f)
973+
f.debug_struct("Socket")
974+
.field("raw", &self.inner)
975+
.field("local_addr", &self.local_addr().ok())
976+
.field("peer_addr", &self.peer_addr().ok())
977+
.finish()
974978
}
975979
}
976980

0 commit comments

Comments
 (0)