#[export]
Expand description
Exports handlers for this actor. The set of exported handlers
determine the messages that may be sent to remote references of
the actor ([hyperaxtor::ActorRef
]). Only messages that implement
[hyperactor::RemoteMessage
] may be exported.
Additionally, an exported actor may be remotely spawned,
indicated by spawn = true
. Such actors must also ensure that
their parameter type implements [hyperactor::RemoteMessage
].
§Example
In the following example, MyActor
can be spawned remotely. It also has
exports handlers for two message types, MyMessage
and MyOtherMessage
.
Consequently, ActorRef
s of the actor’s type may dispatch messages of these
types.
ⓘ
#[export(
spawn = true,
handlers = [
MyMessage,
MyOtherMessage,
],
)]
struct MyActor {}