pub struct FsmStateBuilder<TFsm, TContext, TState, M = SyncMode> { /* private fields */ }Implementations§
Source§impl<TFsm, TContext, TState> FsmStateBuilder<TFsm, TContext, TState, SyncMode>where
TFsm: FsmBackend,
impl<TFsm, TContext, TState> FsmStateBuilder<TFsm, TContext, TState, SyncMode>where
TFsm: FsmBackend,
Sourcepub fn on_entry<'a, TAction: Fn(&mut TState, &mut EventContext<'a, TFsm, FsmQueueMock<TFsm>>)>(
&self,
_action: TAction,
) -> &Self
pub fn on_entry<'a, TAction: Fn(&mut TState, &mut EventContext<'a, TFsm, FsmQueueMock<TFsm>>)>( &self, _action: TAction, ) -> &Self
Execute this action when entering the state.
Sourcepub fn on_exit<'a, TAction: Fn(&mut TState, &mut EventContext<'a, TFsm, FsmQueueMock<TFsm>>)>(
&self,
_action: TAction,
) -> &Self
pub fn on_exit<'a, TAction: Fn(&mut TState, &mut EventContext<'a, TFsm, FsmQueueMock<TFsm>>)>( &self, _action: TAction, ) -> &Self
Execute this action when exiting the state.
Source§impl<TFsm, TContext, TState> FsmStateBuilder<TFsm, TContext, TState, AsyncMode>where
TFsm: FsmBackend,
impl<TFsm, TContext, TState> FsmStateBuilder<TFsm, TContext, TState, AsyncMode>where
TFsm: FsmBackend,
Sourcepub fn on_entry<'a, TAction: AsyncFn(&mut TState, &mut EventContext<'a, TFsm, FsmQueueMock<TFsm>>)>(
&self,
_action: TAction,
) -> &Self
pub fn on_entry<'a, TAction: AsyncFn(&mut TState, &mut EventContext<'a, TFsm, FsmQueueMock<TFsm>>)>( &self, _action: TAction, ) -> &Self
Execute this async action when entering the state. Use an async closure: async |state, ctx| { .. }.
Sourcepub fn on_exit<'a, TAction: AsyncFn(&mut TState, &mut EventContext<'a, TFsm, FsmQueueMock<TFsm>>)>(
&self,
_action: TAction,
) -> &Self
pub fn on_exit<'a, TAction: AsyncFn(&mut TState, &mut EventContext<'a, TFsm, FsmQueueMock<TFsm>>)>( &self, _action: TAction, ) -> &Self
Execute this async action when exiting the state. Use an async closure: async |state, ctx| { .. }.
Source§impl<TFsm, TContext, TState, M> FsmStateBuilder<TFsm, TContext, TState, M>where
TFsm: FsmBackend,
impl<TFsm, TContext, TState, M> FsmStateBuilder<TFsm, TContext, TState, M>where
TFsm: FsmBackend,
Sourcepub fn on_event<TEvent>(
&self,
) -> FsmEventBuilderState<'_, TFsm, TContext, TEvent, TState, M>
pub fn on_event<TEvent>( &self, ) -> FsmEventBuilderState<'_, TFsm, TContext, TEvent, TState, M>
What happens if we receive this event and we are in this state right now?
A state can have several transitions for the same event. They are tried in the order of their declaration, the first one whose guard passes is taken. A transition after one without a guard could never be taken, and is rejected by the code generator.
Sourcepub fn on_entry_start_timer<FSetup, FTrigger>(
&self,
_setup: FSetup,
_trigger: FTrigger,
) -> FsmStateTimerBuilder<'_, TFsm, TContext, TState, M>where
FSetup: Fn(&mut TContext, &mut TimerFsmSettings),
FTrigger: Fn(&TContext, &TState) -> Option<<TFsm as FsmBackend>::Events>,
pub fn on_entry_start_timer<FSetup, FTrigger>(
&self,
_setup: FSetup,
_trigger: FTrigger,
) -> FsmStateTimerBuilder<'_, TFsm, TContext, TState, M>where
FSetup: Fn(&mut TContext, &mut TimerFsmSettings),
FTrigger: Fn(&TContext, &TState) -> Option<<TFsm as FsmBackend>::Events>,
Start a new timer when entering this state. The timer should be unit struct with a implemented Default trait. The timer is setup within a closure and the trigger is another closure that returns an event to be enqueued in the FSM.