Function spawn

Source
pub fn spawn<T: Actor + MessageHandler + 'static>(
    args: T::Args,
) -> (ActorRef<T>, JoinHandle<ActorResult<T>>)
Expand description

Spawns a new actor and returns an ActorRef<T> to it, along with a JoinHandle.

Takes initialization arguments that will be passed to the actor’s on_start method. The JoinHandle can be used to await the actor’s termination and retrieve the actor result as an ActorResult<T>.