Shorten debug for messages
This commit is contained in:
parent
32a220f17c
commit
18c845d6f0
3 changed files with 10 additions and 4 deletions
|
|
@ -170,7 +170,7 @@ pub struct Node {
|
||||||
|
|
||||||
impl core::fmt::Debug for Node {
|
impl core::fmt::Debug for Node {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "<{:?}; {}>", self.id, self.addr)
|
write!(f, "{}={:?}", self.addr, self.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -721,12 +721,20 @@ enum Request {
|
||||||
Ping,
|
Ping,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
enum ResponseOrError {
|
enum ResponseOrError {
|
||||||
Response(Response<ByteString>),
|
Response(Response<ByteString>),
|
||||||
Error(ErrorDescription<ByteString>),
|
Error(ErrorDescription<ByteString>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl core::fmt::Debug for ResponseOrError {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Response(r) => write!(f, "{r:?}"),
|
||||||
|
Self::Error(e) => write!(f, "{e:?}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct DhtWorker {
|
struct DhtWorker {
|
||||||
socket: UdpSocket,
|
socket: UdpSocket,
|
||||||
dht: Arc<DhtState>,
|
dht: Arc<DhtState>,
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,9 @@ impl FromStr for Id20 {
|
||||||
|
|
||||||
impl std::fmt::Debug for Id20 {
|
impl std::fmt::Debug for Id20 {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "<")?;
|
|
||||||
for byte in self.0 {
|
for byte in self.0 {
|
||||||
write!(f, "{byte:02x?}")?;
|
write!(f, "{byte:02x?}")?;
|
||||||
}
|
}
|
||||||
write!(f, ">")?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue