StateMachineBuilder

Trait StateMachineBuilder 

Source
pub trait StateMachineBuilder<State, Input, Transition>
where Transition: Fn(&State, Input) -> State, State: Clone,
{ type Output; // Required methods fn start() -> Self; fn initial_state(self, state: State) -> Self; fn current_state(self, state: State) -> Self; fn transition(self, next: Transition) -> Self; fn build(self) -> Result<Self::Output, Box<dyn Error>>; }

Required Associated Types§

Required Methods§

Source

fn start() -> Self

Starts the builder.

Source

fn initial_state(self, state: State) -> Self

Sets particular initial state to the state machine.

Source

fn current_state(self, state: State) -> Self

Sets particular state to the current state.

Source

fn transition(self, next: Transition) -> Self

Sets particular transition algorithm to the state machine.

Source

fn build(self) -> Result<Self::Output, Box<dyn Error>>

To finish the builder. If it fails, returns crate::machine::error::StateMachineError.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<State, Input, Transition> StateMachineBuilder<State, Input, Transition> for BasicStateMachineBuilder<State, Input, Transition>
where Transition: Fn(&State, Input) -> State, State: Clone,

Source§

type Output = BasicStateMachine<State, Input, Transition>