Trait oasis_contract_sdk::event::Event
source · pub trait Event: Sized + Encode {
// Required methods
fn module_name(&self) -> &str;
fn code(&self) -> u32;
// Provided method
fn into_raw(self) -> Event { ... }
}
Expand description
An event emitted by the contract.
This trait can be derived:
#[derive(Clone, Debug, cbor::Encode, Event)]
#[cbor(untagged)]
#[sdk_event(autonumber)]
enum MyEvent {
Greeting(String), // autonumbered to 0
#[sdk_event(code = 2)] // manually numbered to 2 (`code` is required if not autonumbering)
DontPanic,
Salutation { // autonumbered to 1
plural: bool,
}
}
Required Methods§
sourcefn module_name(&self) -> &str
fn module_name(&self) -> &str
Name of the module that emitted the event.
Provided Methods§
Object Safety§
This trait is not object safe.