Skip to main content

EventDecoder

Trait EventDecoder 

Source
pub trait EventDecoder: Send + Sync {
    // Required method
    fn decode(&self, log: &Log, view: &dyn StateView) -> Vec<StateUpdate>;
}
Expand description

Decode one log into zero or more targeted StateUpdates.

decode is a pure function of (log, pre-state): it performs no I/O and emits data (the updates are serializable and replayable against matching pre-state). The pipeline applies the result through apply_updates.

A decoder returns vec![] for any log it does not recognise (wrong topic0, an unregistered emitting address, a malformed payload). The pipeline counts a log as decoded only when some decoder produced at least one update for it.

Required Methods§

Source

fn decode(&self, log: &Log, view: &dyn StateView) -> Vec<StateUpdate>

Decode log against the read-only pre-state view into targeted updates.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§