From 7ba2a6b61f47535e17c8f87e0bfac735e950c871 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 3 Aug 2021 19:43:53 +0100 Subject: [PATCH] queue debug Signed-off-by: Ian Jackson --- src/bin/client.rs | 2 +- src/queue.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bin/client.rs b/src/bin/client.rs index 1af2d30..e21020c 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -256,7 +256,7 @@ async fn run_client( Ok(()) }, |e| error!("{} #{}: rx discarding: {}", &ic, req_num, e)); - dbg!(&rx_queue.remaining()); + dbg!(&rx_queue); rx_queue = default(); // xxx } } diff --git a/src/queue.rs b/src/queue.rs index a7e0bb5..21be105 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -11,6 +11,16 @@ pub struct Queue { queue: VecDeque>, } +impl Debug for Queue { + #[throws(fmt::Error)] + fn fmt(&self, f: &mut fmt::Formatter) { + write!(f, "Queue{{content={},eaten1={},queue=[", + self.content, self.eaten1)?; + for q in &self.queue { write!(f, "{},", q.len())?; } + write!(f, "]}}")?; + } +} + impl Queue { pub fn push>>(&mut self, b: B) { self.push_(b.into()); -- 2.30.2