pub fn spawn<T, F, K>(func: F) -> (JoinHandle<Result<T>>, NativeProcess) where
    T: Send + 'static,
    K: Future<Output = ExecutionResult<T>> + Send + 'static,
    F: FnOnce(NativeProcess, MessageMailbox) -> K, 
Expand description

Spawns a process from a closure.

Example:

let _proc = lunatic_runtime::spawn(|_this, mailbox| async move {
    // Wait on a message with the tag `27`.
    mailbox.pop(Some(&[27])).await;
    Ok(())
});