Skip to content

Commit

Permalink
feat: implement Debug for Connection
Browse files Browse the repository at this point in the history
The debug output includes the connection ID and the remote address.
Non-exhaustive formatting is used to be clear that this is not a valid
`Connection` representation.
  • Loading branch information
Chris Connelly authored and bochaco committed Nov 4, 2021
1 parent 42f1e45 commit 966567e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ impl Connection {
}
}

impl fmt::Debug for Connection {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Connection")
.field("id", &self.id())
.field("remote_address", &self.remote_address())
.finish_non_exhaustive()
}
}

/// The sending API for a QUIC stream.
pub struct SendStream {
inner: quinn::SendStream,
Expand Down

0 comments on commit 966567e

Please sign in to comment.