Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions src/components/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use linear_block_store::InMemBlockStore;

pub(crate) type Storage = InMemStorage<Block>;

#[derive(Debug)]
pub(crate) enum Event<S: StorageType>
where
<S::BlockStore as BlockStoreType>::Block: Debug,
Expand All @@ -37,21 +38,6 @@ where
},
}

impl<S: StorageType> Debug for Event<S> {
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<S: StorageType> Display for Event<S> {
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
match self {
Expand Down
10 changes: 8 additions & 2 deletions src/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -82,13 +83,18 @@ impl<T, Ev> Responder<T, Ev> {

impl<T, Ev> Debug for Responder<T, Ev> {
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
write!(formatter, "responder")
write!(
formatter,
"Responder<{}->{}>",
type_name::<T>(),
type_name::<Effect<Ev>>()
)
}
}

impl<T, Ev> Display for Responder<T, Ev> {
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
Debug::fmt(self, formatter)
write!(formatter, "responder({})", type_name::<T>(),)
}
}

Expand Down