mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: impl Display for ChainEvent (#11056)
This commit is contained in:
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user