pub trait BatchEventHandler {
type Error;
// Required method
fn handle_event(&mut self, event: BatchEvent) -> Result<(), Self::Error>;
// Provided method
fn handle_events(
&mut self,
events: Vec<BatchEvent>,
) -> Result<(), Self::Error> { ... }
}Available on crate feature
std only.Expand description
A handler for batch events.
Implementations receive events as they are processed from the blockchain and update internal state accordingly.
Required Associated Types§
Required Methods§
Sourcefn handle_event(&mut self, event: BatchEvent) -> Result<(), Self::Error>
fn handle_event(&mut self, event: BatchEvent) -> Result<(), Self::Error>
Handles a batch event.
Implementations should update any internal state (e.g., batch store) based on the event.
Provided Methods§
Sourcefn handle_events(&mut self, events: Vec<BatchEvent>) -> Result<(), Self::Error>
fn handle_events(&mut self, events: Vec<BatchEvent>) -> Result<(), Self::Error>
Handles a batch of events atomically.
The default implementation calls handle_event for each event,
but implementations may override this for better performance
or transactional semantics.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".