alloy_dyn_abi

Trait EventExt

Source
pub trait EventExt: Sealed {
    // Required method
    fn decode_log_parts<I>(
        &self,
        topics: I,
        data: &[u8],
        validate: bool,
    ) -> Result<DecodedEvent>
       where I: IntoIterator<Item = B256>;

    // Provided method
    fn decode_log(&self, log: &LogData, validate: bool) -> Result<DecodedEvent> { ... }
}
Expand description

Provides event encoding and decoding for the Event type.

This trait is sealed and cannot be implemented for types outside of this crate. It is implemented only for Event.

Required Methods§

Source

fn decode_log_parts<I>( &self, topics: I, data: &[u8], validate: bool, ) -> Result<DecodedEvent>
where I: IntoIterator<Item = B256>,

Decodes the given log info according to this item’s input types.

The topics parameter is the list of indexed topics, and the data parameter is the non-indexed data.

The first topic is skipped, unless the event is anonymous.

For more details, see the Solidity reference.

§Errors

This function will return an error if the decoded data does not match the expected input types.

Provided Methods§

Source

fn decode_log(&self, log: &LogData, validate: bool) -> Result<DecodedEvent>

Decodes the given log object according to this item’s input types.

See decode_log.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EventExt for Event

Source§

fn decode_log_parts<I>( &self, topics: I, data: &[u8], validate: bool, ) -> Result<DecodedEvent>
where I: IntoIterator<Item = B256>,

Implementors§