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-10-18 01:15:04 +02:00
parent bc1d9ed495
commit 8e331ce182
No known key found for this signature in database
1 changed files with 11 additions and 1 deletions

View File

@ -51,7 +51,6 @@ pub enum TransportState {
/// Transport is an adaptor around a specific [`Session`] (implementing /// Transport is an adaptor around a specific [`Session`] (implementing
/// session management, including optional handshake, encoding, etc.) to be used /// session management, including optional handshake, encoding, etc.) to be used
/// as a transport resource in a [`crate::reactor::Reactor`]. /// as a transport resource in a [`crate::reactor::Reactor`].
#[derive(Debug)]
pub struct Transport<S: Session> { pub struct Transport<S: Session> {
state: TransportState, state: TransportState,
session: S, session: S,
@ -61,6 +60,17 @@ pub struct Transport<S: Session> {
write_buffer: VecDeque<u8>, 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> { impl<S: Session + Source> Source for Transport<S> {
fn register( fn register(
&mut self, &mut self,