pub trait RemoteSpawn:
Actor
+ Referable
+ Binds<Self> {
type Params: RemoteMessage;
// Required method
fn new<'async_trait>(
params: Self::Params,
environment: Flattrs,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided methods
fn gspawn(
proc: &Proc,
name: &str,
serialized_params: Data,
environment: Flattrs,
) -> Pin<Box<dyn Future<Output = Result<ActorId, Error>> + Send>> { ... }
fn get_type_id() -> TypeId { ... }
}Expand description
An Actor that can be spawned remotely.
Bounds explained:
Actor: only actors may be remotely spawned.Referable: marks the type as eligible for typed remote references (ActorRef<A>); required because remote spawn ultimately hands back anActorIdthat higher-level APIs may re-type asActorRef<A>.Binds<Self>: lets the runtime wire this actor’s message ports when it is spawned (the blanket impl callshandle.bind::<Self>()).
gspawn is a type-erased entry point used by the remote
spawn/registry machinery. It takes serialized params and returns
the new actor’s ActorId; application code shouldn’t call it
directly.
Required Associated Types§
Sourcetype Params: RemoteMessage
type Params: RemoteMessage
The type of parameters used to instantiate the actor remotely.
Required Methods§
Sourcefn new<'async_trait>(
params: Self::Params,
environment: Flattrs,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
fn new<'async_trait>(
params: Self::Params,
environment: Flattrs,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
Creates a new actor instance given its instantiation parameters.
The environment allows whoever is responsible for spawning this actor
to pass in additional context that may be useful.
Provided Methods§
Sourcefn gspawn(
proc: &Proc,
name: &str,
serialized_params: Data,
environment: Flattrs,
) -> Pin<Box<dyn Future<Output = Result<ActorId, Error>> + Send>>
fn gspawn( proc: &Proc, name: &str, serialized_params: Data, environment: Flattrs, ) -> Pin<Box<dyn Future<Output = Result<ActorId, Error>> + Send>>
A type-erased entry point to spawn this actor. This is primarily used by hyperactor’s remote actor registration mechanism.
Sourcefn get_type_id() -> TypeId
fn get_type_id() -> TypeId
The type ID of this actor.
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.