Implement Display for PeerId/ConnectionId
Implement display for these two source structs, in order to improve
logging with their use.
@@ -54,6 +54,12 @@ impl From<PeerId> for String {
}
}
+impl fmt::Display for PeerId {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.write_str(&self.0)
+ }
+}
+
/// A wrapper for Connection Id
///
/// The type constrains a dispatcher to connection-specific messages
@@ -86,6 +92,12 @@ impl From<ConnectionId> for String {
}
}
+impl fmt::Display for ConnectionId {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.write_str(&self.0)
+ }
+}
+
/// The Message Context
///
/// The message context provides information about an incoming message beyond its parsed bytes. It
