pub struct SerializedExecutor<M: Machine> { /* private fields */ }Expand description
Serialized run-to-completion execution of one machine.
Implementations§
Source§impl<M: Machine> SerializedExecutor<M>
impl<M: Machine> SerializedExecutor<M>
Sourcepub fn submit<H>(
&self,
input: M::Input,
handler: &H,
) -> Result<TurnReceipt, PoisonedInput<M::Input>>where
H: OutputHandler<M::Output>,
pub fn submit<H>(
&self,
input: M::Input,
handler: &H,
) -> Result<TurnReceipt, PoisonedInput<M::Input>>where
H: OutputHandler<M::Output>,
Queue one input and, when this caller acquires ownership, drain turns.
Reentrant and concurrent calls enqueue their input and return a receipt;
they never advance a transition while an earlier output is being handled.
Only the drain owner’s handler processes outputs: a caller that loses
ownership has its input handled by the owner’s handler, while its
receipt still reports completion of its own turn. Waiting on a receipt
from inside handler would deadlock and must be deferred until the
outer turn returns.
§Errors
Returns input ownership when a previous transition or handler panicked.
§Panics
Propagates a machine transition or output-handler panic after poisoning this executor and resolving every outstanding receipt.