mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 09:31:20 +00:00
Improve Debug and Display for PeerId (#1019)
* Improve Debug and Display for PeerId * Update core/src/peer_id.rs Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>
This commit is contained in:
@ -35,7 +35,15 @@ pub struct PeerId {
|
|||||||
|
|
||||||
impl fmt::Debug for PeerId {
|
impl fmt::Debug for PeerId {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "PeerId({})", self.to_base58())
|
f.debug_tuple("PeerId")
|
||||||
|
.field(&self.to_base58())
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for PeerId {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
self.to_base58().fmt(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user