From 9b5c69f37838bed9db12ac6e5cee699bf8d63983 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Sun, 25 Aug 2024 13:32:46 +0100 Subject: [PATCH] Shorten debug for PexPeerInfo --- crates/peer_binary_protocol/src/extended/ut_pex.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/peer_binary_protocol/src/extended/ut_pex.rs b/crates/peer_binary_protocol/src/extended/ut_pex.rs index 149e8c0..73698f2 100644 --- a/crates/peer_binary_protocol/src/extended/ut_pex.rs +++ b/crates/peer_binary_protocol/src/extended/ut_pex.rs @@ -6,12 +6,21 @@ use clone_to_owned::CloneToOwned; use itertools::{EitherOrBoth, Itertools}; use serde::{Deserialize, Serialize}; -#[derive(Debug)] pub struct PexPeerInfo { pub flags: u8, pub addr: SocketAddr, } +impl core::fmt::Debug for PexPeerInfo { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.addr)?; + if self.flags != 0 { + write!(f, ";flags={}", self.flags)?; + } + Ok(()) + } +} + #[derive(Serialize, Default, Deserialize)] pub struct UtPex { added: B,