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§
Sourcefn event_name() -> &'static str
fn event_name() -> &'static str
Returns the event name (e.g., “Transfer”).
Sourcefn event_topics(&self) -> Vec<[u8; 32]>
fn event_topics(&self) -> Vec<[u8; 32]>
Returns the topics for this event instance.
Sourcefn event_data(&self) -> Vec<u8>
fn event_data(&self) -> Vec<u8>
Returns the encoded data for this event instance.
Provided Methods§
Sourcefn is_anonymous() -> bool
fn is_anonymous() -> bool
Returns whether this event is anonymous (no signature topic).
Sourcefn event_signature() -> [u8; 32]
fn event_signature() -> [u8; 32]
Returns the event signature hash.
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.