Skip to main content

RemoteActorFactory

Trait RemoteActorFactory 

Source
pub trait RemoteActorFactory: RemoteActor {
    const TYPE_NAME: &'static str;

    // Required method
    fn create_remote(
        label: String,
        config: String,
    ) -> Result<(Address<Self>, JoinHandle<()>), <Self as Actor>::Error>;
}
Expand description

Extends RemoteActor with the ability to be spawned on demand by peers.

Implementing this trait opts an actor into peer-initiated creation. TYPE_NAME is the type identifier the peer sends in the CreateActor messsage.

Required Associated Constants§

Source

const TYPE_NAME: &'static str

The type name of this actor.

std::any::type_name is not guaranteed to be stable across Rust versions so we require users to provide their own stable type name.

Required Methods§

Source

fn create_remote( label: String, config: String, ) -> Result<(Address<Self>, JoinHandle<()>), <Self as Actor>::Error>

Creates an instance of this actor with the given label and configuration string.

Implementations typically call Actor::create or Actor::run internally and return the actor address and the join handle.

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§