Shorten debug for PexPeerInfo

This commit is contained in:
Igor Katson 2024-08-25 13:32:46 +01:00
parent 9d1ef5c35c
commit 9b5c69f378
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5

View file

@ -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<B> {
added: B,