mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-16 08:10:40 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user