Macro behavior

Source
behavior!() { /* proc-macro */ }
Expand description

Create a [Referable] definition, handling a specific set of message types. Behaviors are used to create an [ActorRef] without having to depend on the actor’s implementation. If the message type need to be cast, add castable flag to those types. e.g. the following example creates a behavior with 5 message types, and 4 of which need to be cast.

hyperactor::behavior!(
    TestActorBehavior,
    TestMessage { castable = true },
    () {castable = true },
    MyGeneric<()> {castable = true },
    u64,
);

This macro also supports generic behaviors:

hyperactor::behavior!(
    TestBehavior<T>,
    Message<T> { castable = true },
    u64,
);