Add more detailed Debug for MapSource (#56)
and everything it contains. Stop short of printing all of the bytes in a State's VecDeque, but expose most everything else for easier troubleshooting.
This commit is contained in:
parent
c53b3ddbe0
commit
5423d7c93a
|
@ -49,7 +49,7 @@ impl Deref for Publisher {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Subscriber {
|
||||
pub info: Arc<Info>,
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ impl fmt::Debug for Publisher {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Subscriber {
|
||||
pub name: String,
|
||||
|
||||
|
@ -72,12 +72,6 @@ impl Subscriber {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Subscriber {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "track subscriber: {:?}", self.name)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Error {
|
||||
pub code: VarInt,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use core::fmt;
|
||||
use std::collections::VecDeque;
|
||||
use tokio::sync::watch;
|
||||
|
||||
|
@ -7,6 +8,18 @@ struct State<T> {
|
|||
drained: usize,
|
||||
}
|
||||
|
||||
impl<T> fmt::Debug for State<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"State<{}> ( queue.len(): {}, drained: {} )",
|
||||
std::any::type_name::<T>(),
|
||||
&self.queue.len(),
|
||||
&self.drained
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> State<T> {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
@ -85,7 +98,7 @@ impl<T: Clone> Default for Publisher<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Subscriber<T: Clone> {
|
||||
state: watch::Receiver<State<T>>,
|
||||
index: usize,
|
||||
|
|
Loading…
Reference in New Issue