Function spawn

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

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

The JoinHandle can be used to await the actor’s termination and retrieve the actor instance and its ActorStopReason.