Skip to main content

RemoteActor

Trait RemoteActor 

Source
pub trait RemoteActor: Actor + Handler<RemoteMessage> { }
Expand description

A marker trait for actors which can be reached over IPC.

To make an actor reachable over IPC, the user should implement the Handler<RemoteMessage> trait for an actor to define how it processes inbound remote messages, and then register the actor’s address in the Node’s RemoteActorRegistry via the with_actor method or the AddActor command.

It is highly recommended to use the #[acktor_ipc::remote] attribute macro to annotate the impl Actor for MyActor { ... } block of a remote actor. The macro overrides the Actor::type_erased_recipient_fn hook, which will opt-in the type-erased-recipient-hook feature, and allow conversion from any Reciepient type of this actor to a Recipient<RemoteMessage>. With the help of this hook, the actor’s address can be registered in the Node’s RemoteActorRegistry automatically. This is more convenient than registering the actor manually.

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§