Skip to main content

ExclusiveExecutor

Struct ExclusiveExecutor 

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

Allocation-free execution of an affine machine through exclusive access.

A turn installs the poisoned state before calling Machine::step. If the transition unwinds, no machine remains accessible and all future inputs are rejected intact. Output consumption after a successful turn is outside this poison boundary.

Implementations§

Source§

impl<M: Machine> ExclusiveExecutor<M>

Source

pub const fn new(machine: M) -> Self

Construct an executor containing machine.

Source

pub fn turn( &mut self, input: M::Input, ) -> Result<M::Output, PoisonedInput<M::Input>>

Execute one immediate turn and install its successor.

§Errors

Returns the supplied input without accepting it if an earlier transition poisoned the executor. An input consumed by a transition that panics is not recoverable.

§Panics

Propagates a panic from Machine::step after poisoning the executor.

Source

pub const fn state(&self) -> ExclusiveState

Report whether a successor machine remains available.

Source

pub const fn machine(&self) -> Option<&M>

Borrow the current successor machine, or None if it was poisoned.

Source

pub fn into_inner(self) -> Result<M, ExclusivePoisoned>

Recover the current successor machine.

§Errors

Returns ExclusivePoisoned if a panicking transition consumed it.

Trait Implementations§

Source§

impl<M: Debug + Machine> Debug for ExclusiveExecutor<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M> Freeze for ExclusiveExecutor<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for ExclusiveExecutor<M>
where M: RefUnwindSafe,

§

impl<M> Send for ExclusiveExecutor<M>
where M: Send,

§

impl<M> Sync for ExclusiveExecutor<M>
where M: Sync,

§

impl<M> Unpin for ExclusiveExecutor<M>
where M: Unpin,

§

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

§

impl<M> UnwindSafe for ExclusiveExecutor<M>
where M: UnwindSafe,

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.