stratus::ledger::events

Trait Event

Source
pub trait Event:
    Serialize
    + Sized
    + Debug {
    // Required method
    fn event_key(&self) -> Result<String>;

    // Provided methods
    fn event_headers(&self) -> Result<HashMap<String, String>> { ... }
    fn event_payload(&self) -> Result<String> { ... }
}
Expand description

Struct is an event that can be published to external systems.

Required Methods§

Source

fn event_key(&self) -> Result<String>

Returns the partition key component of the event.

Provided Methods§

Source

fn event_headers(&self) -> Result<HashMap<String, String>>

Returns the headers component of the event.

By default, it returns empty headers.

Source

fn event_payload(&self) -> Result<String>

Returns the payload component of the event.

By default, it serializes the implementing struct as JSON.

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§