node/reactor/transport: Implement Debug

The derived implmenetation prints read and write buffers, which is too
much even for trace logging (where we use this trait).
This commit is contained in:
Lorenz Leutgeb
2025-11-01 11:20:43 +01:00
parent bc1d9ed495
commit 8e331ce182
+11 -1
View File
@@ -51,7 +51,6 @@ pub enum TransportState {
/// Transport is an adaptor around a specific [`Session`] (implementing
/// session management, including optional handshake, encoding, etc.) to be used
/// as a transport resource in a [`crate::reactor::Reactor`].
#[derive(Debug)]
pub struct Transport<S: Session> {
state: TransportState,
session: S,
@@ -61,6 +60,17 @@ pub struct Transport<S: Session> {
write_buffer: VecDeque<u8>,
}
impl<S: Session> std::fmt::Debug for Transport<S> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("Transport")
.field("session", &self.session.display())
.field("state", &self.state)
.field("link_direction", &self.link_direction)
.field("write_intent", &self.write_intent)
.finish()
}
}
impl<S: Session + Source> Source for Transport<S> {
fn register(
&mut self,