Skip to main content

BatchEventHandler

Trait BatchEventHandler 

Source
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§

Source

type Error

The error type returned when handling fails.

Required Methods§

Source

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§

Source

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".

Implementors§