Function lunatic::process::spawn_with[][src]

pub fn spawn_with<C: Serialize + DeserializeOwned, T: Serialize + DeserializeOwned>(
    context: C,
    function: fn(_: C, _: Mailbox<T>)
) -> Result<Process<T>, LunaticError>
Expand description

Spawns a new process from a function and context.

  • context is data that we want to pass to the newly spawned process. It needs to impl. the [Serialize + DeserializeOwned] trait.

  • function is the starting point of the new process. The new process doesn’t share memory with its parent, because of this the function can’t capture anything from parents. The first argument of this function is going to be the received context.