pub trait RemoteSpawn:
Actor
+ Referable
+ Binds<Self> {
type Params: RemoteMessage;
// Required method
fn new<'life0, 'async_trait>(
params: Self::Params,
environment: &'life0 ActorEnvironment,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn gspawn_root_bind(
proc: &Proc,
uid: Uid,
serialized_params: Data,
environment: ActorEnvironment,
) -> Pin<Box<dyn Future<Output = Result<ActorAddr, Error>> + Send>> { ... }
fn gspawn_child(
proc: &Proc,
parent: InstanceCell,
uid: Uid,
serialized_params: Data,
environment: ActorEnvironment,
) -> Pin<Box<dyn Future<Output = Result<AnyActorHandle, 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 anActorAddrthat higher-level APIs may re-type asActorRef<A>.Binds<Self>: lets the runtime wire this actor’s handler ports when it is spawned (the blanket impl callshandle.bind::<Self>()).
gspawn_root_bind is a type-erased entry point used by the remote
spawn/registry machinery. It takes serialized params and returns
the new actor’s ActorAddr; 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<'life0, 'async_trait>(
params: Self::Params,
environment: &'life0 ActorEnvironment,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn new<'life0, 'async_trait>(
params: Self::Params,
environment: &'life0 ActorEnvironment,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a new actor instance given its instantiation parameters.
The caller shapes environment with any construction context before
spawning. The runtime stores the same environment unchanged.
Provided Methods§
Sourcefn gspawn_root_bind(
proc: &Proc,
uid: Uid,
serialized_params: Data,
environment: ActorEnvironment,
) -> Pin<Box<dyn Future<Output = Result<ActorAddr, Error>> + Send>>
fn gspawn_root_bind( proc: &Proc, uid: Uid, serialized_params: Data, environment: ActorEnvironment, ) -> Pin<Box<dyn Future<Output = Result<ActorAddr, Error>> + Send>>
A type-erased entry point to spawn this actor as a root. This is primarily used by hyperactor’s remote actor registration mechanism.
Sourcefn gspawn_child(
proc: &Proc,
parent: InstanceCell,
uid: Uid,
serialized_params: Data,
environment: ActorEnvironment,
) -> Pin<Box<dyn Future<Output = Result<AnyActorHandle, Error>> + Send>>
fn gspawn_child( proc: &Proc, parent: InstanceCell, uid: Uid, serialized_params: Data, environment: ActorEnvironment, ) -> Pin<Box<dyn Future<Output = Result<AnyActorHandle, Error>> + Send>>
A type-erased entry point to spawn this actor as a child.
The returned handle is lifecycle-only; callers that know the concrete
actor type can recover a typed handle with AnyActorHandle::downcast.
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".