Skip to main content

spawn

Function spawn 

Source
pub async fn spawn<T>(
    args: <T as Actor>::Arguments,
) -> Result<(ActorRef<<T as Actor>::Msg>, JoinHandle<()>), SpawnErr>
where T: Actor + Default,
Expand description

Perform a background-spawn of an actor. This is a utility wrapper over Actor::spawn which assumes the actor implementation implements Default.

  • args - The arguments to start the actor

Returns [Ok((ActorRef, JoinHandle<()>))] upon successful actor startup, [Err(SpawnErr)] otherwise