Skip to main content

Crate maiko_macros

Crate maiko_macros 

Source
Expand description

Procedural macros for the Maiko actor runtime.

  • #[derive(Event)]: Implements maiko::Event for your type, preserving generics and bounds.
  • #[derive(Label)]: Implements maiko::Label for enums, returning variant names.
  • #[derive(SelfRouting)]: Implements maiko::Topic<T> for T for event-as-topic routing.

Usage:

use maiko::{Event, Label, SelfRouting};

// Simple event without topic routing
#[derive(Clone, Debug, Event)]
enum MyEvent { Foo, Bar }

// Event with labels for observability (logging, diagrams)
#[derive(Clone, Debug, Event, Label)]
enum MyEvent { Foo, Bar }

// Event that routes itself (event-as-topic pattern)
#[derive(Clone, Debug, Hash, PartialEq, Eq, Event, SelfRouting, Label)]
enum PingPong { Ping, Pong }

Derive Macros§

Event
Derives Event marker trait for the type.
Label
Derives Label trait for enums, returning variant names.
SelfRouting
Derives Topic<Self> for Self enabling event-as-topic routing.