Skip to content

Commit 1c1917b

Browse files
committed
Create debug formatter for SerializedResponse.
1 parent 406b04d commit 1c1917b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
extern crate core;
1111

1212
use std::collections::{HashMap, HashSet};
13+
#[cfg(test)]
14+
use std::fmt::{Debug, Formatter};
1315
use std::fs::File;
1416
use std::io::BufReader;
1517
use std::ops::Deref;
@@ -114,6 +116,21 @@ impl<L: Deref + Clone + Send + Sync + 'static> RapidSyncProcessor<L> where L::Ta
114116
}
115117
}
116118

119+
#[cfg(test)]
120+
impl Debug for SerializedResponse {
121+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
122+
write!(
123+
f,
124+
"\nmessages: {}\n\tannouncements: {}\n\tupdates: {}\n\t\tfull: {}\n\t\tincremental: {}",
125+
self.message_count,
126+
self.announcement_count,
127+
self.update_count,
128+
self.update_count_full,
129+
self.update_count_incremental
130+
)
131+
}
132+
}
133+
117134
pub(crate) async fn connect_to_db() -> Client {
118135
let connection_config = config::db_connection_config();
119136
let (client, connection) = connection_config.connect(NoTls).await.unwrap();

0 commit comments

Comments
 (0)