pub trait MachineTrans<X> {
type Observation;
// Required methods
fn transit(&mut self, x: X);
fn observe(&self) -> Self::Observation;
fn initial(&mut self);
}Expand description
Required Associated Types§
Sourcetype Observation
type Observation
An associated type for capturing the machine’s state or output observations.
Required Methods§
Sourcefn transit(&mut self, x: X)
fn transit(&mut self, x: X)
Transitions the state machine to a new state based on the input.
This method modifies the machine’s current state according to
the specified input x. The exact details of the transition
mechanism are determined by the implementer.
§Parameters
x: An input value of typeXthat influences the state change.
Sourcefn observe(&self) -> Self::Observation
fn observe(&self) -> Self::Observation
Makes an observation of the machine’s current state.
This method returns an abstract representation of the state or output
of the machine as defined by the Observation associated type.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl MachineTrans<u8> for CANFrameMachine
impl MachineTrans<u8> for CANFrameMachine
type Observation = Option<CANFrame>
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.