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: M0The first state machine.
m1: M1The 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.
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
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)
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
fn observe(&self) -> Self::Observation
Observes and returns the current state of the composed machine.
The observation is based on M1.