diff --git a/src/components/storage.rs b/src/components/storage.rs index 1a65ccb1bd..9044549b05 100644 --- a/src/components/storage.rs +++ b/src/components/storage.rs @@ -23,6 +23,7 @@ use linear_block_store::InMemBlockStore; pub(crate) type Storage = InMemStorage; +#[derive(Debug)] pub(crate) enum Event where ::Block: Debug, @@ -37,21 +38,6 @@ where }, } -impl Debug for Event { - fn fmt(&self, formatter: &mut Formatter) -> fmt::Result { - match self { - Event::PutBlock { block, .. } => { - write!(formatter, "Event::PutBlock {{ block: {:?} }}", block) - } - Event::GetBlock { block_hash, .. } => write!( - formatter, - "Event::GetBlock {{ block_hash: {:?} }}", - block_hash - ), - } - } -} - impl Display for Event { fn fmt(&self, formatter: &mut Formatter) -> fmt::Result { match self { diff --git a/src/effect.rs b/src/effect.rs index ffd5d5f895..ad10f71f18 100644 --- a/src/effect.rs +++ b/src/effect.rs @@ -36,6 +36,7 @@ //! effects to turn them into events should also be kept brief. use std::{ + any::type_name, fmt::{self, Debug, Display, Formatter}, future::Future, time::{Duration, Instant}, @@ -82,13 +83,18 @@ impl Responder { impl Debug for Responder { fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result { - write!(formatter, "responder") + write!( + formatter, + "Responder<{}->{}>", + type_name::(), + type_name::>() + ) } } impl Display for Responder { fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result { - Debug::fmt(self, formatter) + write!(formatter, "responder({})", type_name::(),) } }