pub struct StateMachine<TCriteria, TAction> { /* private fields */ }
Expand description
A compiled state machine.
The StateMachine
can be created with the Builder
.
Implementations§
Source§impl<TCriteria, TAction> StateMachine<TCriteria, TAction>where
TCriteria: Criteria,
impl<TCriteria, TAction> StateMachine<TCriteria, TAction>where
TCriteria: Criteria,
Source§impl<TCriteria, TAction> StateMachine<TCriteria, TAction>where
TAction: Action,
impl<TCriteria, TAction> StateMachine<TCriteria, TAction>where
TAction: Action,
Sourcepub fn execute(&self, current: MachineState, input: &mut TAction::Input)
pub fn execute(&self, current: MachineState, input: &mut TAction::Input)
Executes the actions of the current
state with the given input
.
Use Self::execute_mut
if the current TAction
is an ActionMut
.
Source§impl<TCriteria, TAction> StateMachine<TCriteria, TAction>where
TAction: ActionMut,
impl<TCriteria, TAction> StateMachine<TCriteria, TAction>where
TAction: ActionMut,
Sourcepub fn execute_mut(&mut self, current: MachineState, input: &mut TAction::Input)
pub fn execute_mut(&mut self, current: MachineState, input: &mut TAction::Input)
Executes the actions of the current
state with the given input
.
Use Self::execute
if the current TAction
is an Action
.
Source§impl<TCriteria, TAction> StateMachine<TCriteria, TAction>
impl<TCriteria, TAction> StateMachine<TCriteria, TAction>
Sourcepub fn step_and_execute(
&self,
current: MachineState,
input: &mut TAction::Input,
) -> MachineState
pub fn step_and_execute( &self, current: MachineState, input: &mut TAction::Input, ) -> MachineState
Performs a step from the current state
and executes any actions based on the new state.
This method is available only if the TCriteria
and TAction
have the same Input
type
and is equivalent to:
ⓘ
let next_state = machine.step(current_state, &input);
machine.execute(current_state, &mut input);
Source§impl<TCriteria, TAction> StateMachine<TCriteria, TAction>
impl<TCriteria, TAction> StateMachine<TCriteria, TAction>
Sourcepub fn step_and_execute_mut(
&mut self,
current: MachineState,
input: &mut TAction::Input,
) -> MachineState
pub fn step_and_execute_mut( &mut self, current: MachineState, input: &mut TAction::Input, ) -> MachineState
Performs a step from the current state
and executes any actions based on the new state.
This method is available only if the TCriteria
and TAction
have the same Input
type
and is equivalent to:
ⓘ
let next_state = machine.step(current_state, &input);
machine.execute_mut(current_state, &mut input);
Trait Implementations§
Auto Trait Implementations§
impl<TCriteria, TAction> Freeze for StateMachine<TCriteria, TAction>
impl<TCriteria, TAction> RefUnwindSafe for StateMachine<TCriteria, TAction>where
TAction: RefUnwindSafe,
TCriteria: RefUnwindSafe,
impl<TCriteria, TAction> Send for StateMachine<TCriteria, TAction>
impl<TCriteria, TAction> Sync for StateMachine<TCriteria, TAction>
impl<TCriteria, TAction> Unpin for StateMachine<TCriteria, TAction>
impl<TCriteria, TAction> UnwindSafe for StateMachine<TCriteria, TAction>where
TAction: UnwindSafe,
TCriteria: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more