spawn
Source: crates/lvcs/src/runtime/driver.rs.
/// Spawn `machine` on the current tokio runtime as `id`.
///
/// Its mailbox holds `capacity` events (at least 1). Every handled event is
/// handed to `journal` as an entry before any of its outputs is applied;
/// the outputs then go to `sink` in order. The driver stops once the
/// machine reaches sml's terminal state (`sml::Terminated`), or when every
/// [`ActorHandle`] is dropped; the task's result is the events handled.
pub(crate) fn spawn<M, E, O, C, K, J>(
machine: M,
id: ActorId,
capacity: usize,
hooks: Hooks<M, O, C>,
sink: K,
journal: J,
) -> (ActorHandle<E>, JoinHandle<u64>)
where
M: sml::Machine<E> + sml::Terminated + Send + 'static,
E: Clone + Send + 'static,
O: Send + 'static,
C: Send + 'static,
K: FnMut(O) + Send + 'static,
J: FnMut(JournalEntry<E, C>) + Send + 'static,