Skip to content

Commit

Permalink
Impl Debug on a few datatypes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrusu authored and dan-da committed Nov 5, 2020
1 parent e339c7a commit 9dd4076
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Message {
}

/// Main QuicP2p instance to communicate with QuicP2p using an async API
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct QuicP2p {
local_addr: SocketAddr,
allow_random_port: bool,
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::{
const MAX_CACHE_SIZE: usize = 200;

/// A very simple LRU like struct that writes itself to disk every 10 entries added.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct BootstrapCache {
peers: VecDeque<SocketAddr>,
cache_path: PathBuf,
Expand Down
11 changes: 11 additions & 0 deletions src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ pub struct Endpoint {
client_cfg: quinn::ClientConfig,
}

impl std::fmt::Debug for Endpoint {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Endpoint")
.field("local_addr", &self.local_addr)
.field("quic_endpoint", &"<endpoint omitted>".to_string())
.field("quic_incoming", &self.quic_incoming)
.field("client_cfg", &self.client_cfg)
.finish()
}
}

impl Endpoint {
pub(crate) fn new(
quic_endpoint: quinn::Endpoint,
Expand Down

0 comments on commit 9dd4076

Please sign in to comment.