pub fn spawn<T, F, K>(func: F) -> (JoinHandle<Result<T, Error>>, NativeProcess) where
    T: 'static + Send,
    K: 'static + Future<Output = ExecutionResult<T>> + Send,
    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(())
});