pub trait RemotableActor: Actorwhere
Self::Params: RemoteMessage,{
// Required method
fn gspawn(
proc: &Proc,
name: &str,
serialized_params: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<ActorId, Error>> + Send>>;
// Provided method
fn get_type_id() -> TypeId { ... }
}
Expand description
An Actor
that can be spawned remotely.
Blanket-implemented for actors that opt in to remote spawn by also
implementing Referable
and Binds<A>
, with serializable
params:
ⓘ
impl<A> RemotableActor for A
where
A: Actor + Referable + Binds<A>,
A::Params: RemoteMessage,
{}
Bounds explained:
Referable
: marks the type as eligible for typed remote references (ActorRef<A>
); required because remote spawn ultimately hands back anActorId
that higher-level APIs may re-type asActorRef<A>
.Binds<A>
: lets the runtime wire this actor’s message ports when it is spawned (the blanket impl callshandle.bind::<A>()
).A::Params: RemoteMessage
: constructor params must be (de)serializable to cross a process boundary.
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 Methods§
Provided Methods§
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.