Skip to main content

Event

Trait Event 

Source
pub trait Event {
    // Required methods
    fn event_name() -> &'static str;
    fn event_topics(&self) -> Vec<[u8; 32]>;
    fn event_data(&self) -> Vec<u8>;

    // Provided methods
    fn is_anonymous() -> bool { ... }
    fn event_signature() -> [u8; 32] { ... }
    fn emit(&self) -> Result<()>
       where Self: Sized { ... }
}
Expand description

Trait for event types that can be emitted.

Typically derived using #[derive(Event)].

Required Methods§

Source

fn event_name() -> &'static str

Returns the event name (e.g., “Transfer”).

Source

fn event_topics(&self) -> Vec<[u8; 32]>

Returns the topics for this event instance.

Source

fn event_data(&self) -> Vec<u8>

Returns the encoded data for this event instance.

Provided Methods§

Source

fn is_anonymous() -> bool

Returns whether this event is anonymous (no signature topic).

Source

fn event_signature() -> [u8; 32]

Returns the event signature hash.

Source

fn emit(&self) -> Result<()>
where Self: Sized,

Emits this event.

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.

Implementors§