Skip to main content

SerializedExecutor

Struct SerializedExecutor 

Source
pub struct SerializedExecutor<M: Machine> { /* private fields */ }
Expand description

Serialized run-to-completion execution of one machine.

Implementations§

Source§

impl<M: Machine> SerializedExecutor<M>

Source

pub fn new(machine: M) -> Self

Construct a serialized executor with an empty input queue.

Source

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.

Auto Trait Implementations§

§

impl<M> !Freeze for SerializedExecutor<M>

§

impl<M> RefUnwindSafe for SerializedExecutor<M>

§

impl<M> Send for SerializedExecutor<M>
where M: Send, <M as Machine>::Input: Send,

§

impl<M> Sync for SerializedExecutor<M>
where M: Send, <M as Machine>::Input: Send,

§

impl<M> Unpin for SerializedExecutor<M>
where M: Unpin, <M as Machine>::Input: Unpin,

§

impl<M> UnsafeUnpin for SerializedExecutor<M>
where M: UnsafeUnpin,

§

impl<M> UnwindSafe for SerializedExecutor<M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.