[][src]Struct automafish::StateMachine

pub struct StateMachine<TCriteria, TAction> { /* fields omitted */ }

A compiled state machine.

The StateMachine can be created with the Builder.

Implementations

impl<TCriteria, TAction> StateMachine<TCriteria, TAction> where
    TCriteria: Criteria
[src]

pub fn start(&self) -> MachineState[src]

Acquires the initial state of the state machine.

pub fn step(
    &self,
    current: MachineState,
    input: &TCriteria::Input
) -> MachineState
[src]

Performs a step from the current machine state with the given input.

impl<TCriteria, TAction> StateMachine<TCriteria, TAction> where
    TAction: Action
[src]

pub fn execute(&self, current: MachineState, input: &mut TAction::Input)[src]

Executes the actions of the current state with the given input.

Use Self::execute_mut if the current TAction is an ActionMut.

impl<TCriteria, TAction> StateMachine<TCriteria, TAction> where
    TAction: ActionMut
[src]

pub fn execute_mut(&mut self, current: MachineState, input: &mut TAction::Input)[src]

Executes the actions of the current state with the given input.

Use Self::execute if the current TAction is an Action.

impl<TCriteria, TAction> StateMachine<TCriteria, TAction> where
    TAction: Action,
    TCriteria: Criteria<Input = TAction::Input>, 
[src]

pub fn step_and_execute(
    &self,
    current: MachineState,
    input: &mut TAction::Input
) -> MachineState
[src]

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:

This example is not tested
let next_state = machine.step(current_state, &input);
machine.execute(current_state, &mut input);

impl<TCriteria, TAction> StateMachine<TCriteria, TAction> where
    TAction: ActionMut,
    TCriteria: Criteria<Input = TAction::Input>, 
[src]

pub fn step_and_execute_mut(
    &mut self,
    current: MachineState,
    input: &mut TAction::Input
) -> MachineState
[src]

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:

This example is not tested
let next_state = machine.step(current_state, &input);
machine.execute_mut(current_state, &mut input);

Trait Implementations

impl<TCriteria: Debug, TAction: Debug> Debug for StateMachine<TCriteria, TAction>[src]

Auto Trait Implementations

impl<TCriteria, TAction> RefUnwindSafe for StateMachine<TCriteria, TAction> where
    TAction: RefUnwindSafe,
    TCriteria: RefUnwindSafe

impl<TCriteria, TAction> Send for StateMachine<TCriteria, TAction> where
    TAction: Send,
    TCriteria: Send

impl<TCriteria, TAction> Sync for StateMachine<TCriteria, TAction> where
    TAction: Sync,
    TCriteria: Sync

impl<TCriteria, TAction> Unpin for StateMachine<TCriteria, TAction> where
    TAction: Unpin,
    TCriteria: Unpin

impl<TCriteria, TAction> UnwindSafe for StateMachine<TCriteria, TAction> where
    TAction: UnwindSafe,
    TCriteria: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.