Skip to main content

FsmStateBuilder

Struct FsmStateBuilder 

Source
pub struct FsmStateBuilder<TFsm, TContext, TState, M = SyncMode> { /* private fields */ }

Implementations§

Source§

impl<TFsm, TContext, TState> FsmStateBuilder<TFsm, TContext, TState, SyncMode>
where TFsm: FsmBackend,

Source

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.

Source

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,

Source

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| { .. }.

Source

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,

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<TFsm, TContext, TState, M> Freeze for FsmStateBuilder<TFsm, TContext, TState, M>
where PhantomData<TState>: Freeze, PhantomData<TFsm>: Freeze, PhantomData<TContext>: Freeze, PhantomData<M>: Freeze,

§

impl<TFsm, TContext, TState, M> RefUnwindSafe for FsmStateBuilder<TFsm, TContext, TState, M>

§

impl<TFsm, TContext, TState, M> Send for FsmStateBuilder<TFsm, TContext, TState, M>
where PhantomData<TState>: Send, PhantomData<TFsm>: Send, PhantomData<TContext>: Send, PhantomData<M>: Send,

§

impl<TFsm, TContext, TState, M> Sync for FsmStateBuilder<TFsm, TContext, TState, M>
where PhantomData<TState>: Sync, PhantomData<TFsm>: Sync, PhantomData<TContext>: Sync, PhantomData<M>: Sync,

§

impl<TFsm, TContext, TState, M> Unpin for FsmStateBuilder<TFsm, TContext, TState, M>
where PhantomData<TState>: Unpin, PhantomData<TFsm>: Unpin, PhantomData<TContext>: Unpin, PhantomData<M>: Unpin,

§

impl<TFsm, TContext, TState, M> UnsafeUnpin for FsmStateBuilder<TFsm, TContext, TState, M>

§

impl<TFsm, TContext, TState, M> UnwindSafe for FsmStateBuilder<TFsm, TContext, TState, M>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more