Skip to main content

Comp

Struct Comp 

Source
pub struct Comp<M0, M1> {
    pub m0: M0,
    pub m1: M1,
}
Expand description

Represents the composition of two finite state machines, where the output of the first machine (M0) serves as the input to the second machine (M1).

Fields§

§m0: M0

The first state machine.

§m1: M1

The second state machine.

Trait Implementations§

Source§

impl<X, M0, M1> MachineTrans<X> for Comp<M0, M1>
where M0: MachineTrans<X>, <M0 as MachineTrans<X>>::Observation: Final, M1: MachineTrans<<<M0 as MachineTrans<X>>::Observation as Final>::FinalValue>,

Implementation of the MachineTrans trait for the composition of two finite state machines, M0 and M1.

This is applicable when the final values of machine M0 can be used as inputs to machine M1.

A common use case is where M0 processes and decodes some low-level input to generate higher-level inputs for machine M1.

Source§

type Observation = <M1 as MachineTrans<<<M0 as MachineTrans<X>>::Observation as Final>::FinalValue>>::Observation

Observable values of the composed machines derived from M1.

Source§

fn transit(&mut self, x: X)

Processes an input x by passing it through machine M0.

If M0 reaches a final state, its output is utilized as input for machine M1.

Source§

fn observe(&self) -> Self::Observation

Observes and returns the current state of the composed machine.

The observation is based on M1.

Source§

fn initial(&mut self)

Resets both M0 and M1 to their initial states.

Ensures that the entire composite machine starts at its initial configuration.

Auto Trait Implementations§

§

impl<M0, M1> Freeze for Comp<M0, M1>
where M0: Freeze, M1: Freeze,

§

impl<M0, M1> RefUnwindSafe for Comp<M0, M1>

§

impl<M0, M1> Send for Comp<M0, M1>
where M0: Send, M1: Send,

§

impl<M0, M1> Sync for Comp<M0, M1>
where M0: Sync, M1: Sync,

§

impl<M0, M1> Unpin for Comp<M0, M1>
where M0: Unpin, M1: Unpin,

§

impl<M0, M1> UnsafeUnpin for Comp<M0, M1>
where M0: UnsafeUnpin, M1: UnsafeUnpin,

§

impl<M0, M1> UnwindSafe for Comp<M0, M1>
where M0: UnwindSafe, M1: 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.