feat: impl Display for ChainEvent (#11056)

This commit is contained in:
Dan Cline
2024-09-19 18:47:15 -04:00
committed by GitHub
parent 75b7172cf7
commit f9eb20d0a0

View File

@ -2,6 +2,7 @@ use crate::backfill::{BackfillAction, BackfillEvent, BackfillSync};
use futures::Stream;
use reth_stages_api::{ControlFlow, PipelineTarget};
use std::{
fmt::{Display, Formatter, Result},
pin::Pin,
task::{Context, Poll},
};
@ -166,6 +167,25 @@ pub enum ChainEvent<T> {
Handler(T),
}
impl<T: Display> Display for ChainEvent<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
match self {
Self::BackfillSyncStarted => {
write!(f, "BackfillSyncStarted")
}
Self::BackfillSyncFinished => {
write!(f, "BackfillSyncFinished")
}
Self::FatalError => {
write!(f, "FatalError")
}
Self::Handler(event) => {
write!(f, "Handler({event})")
}
}
}
}
/// A trait that advances the chain by handling actions.
///
/// This is intended to be implement the chain consensus logic, for example `engine` API.