KernelMessage

Derive Macro KernelMessage 

Source
#[derive(KernelMessage)]
{
    // Attributes available to this derive:
    #[message]
}
Expand description

Derive macro for kernel messages.

This generates implementations for the BatchMessage trait, providing serialization and type information for batch kernel messages.

§Attributes

  • type_id - Unique message type identifier (optional, defaults to hash of type name)
  • domain - Domain for the message (optional)

§Example

#[derive(Debug, Clone, Serialize, Deserialize, KernelMessage)]
#[message(type_id = 100, domain = "GraphAnalytics")]
pub struct PageRankInput {
    pub graph: CsrGraph,
    pub damping: f64,
}

§Generated Implementation

The macro generates:

  • BatchMessage trait implementation with message_type_id()
  • to_json() and from_json() methods for JSON serialization
  • A message_type_id() associated function on the type itself