[][src]Trait stateright::StateMachine

pub trait StateMachine: Sized {
    type State;
    type Action;
    fn init_states(&self) -> Vec<Self::State>;
fn actions(&self, state: &Self::State, actions: &mut Vec<Self::Action>);
fn next_state(
        &self,
        last_state: &Self::State,
        action: &Self::Action
    ) -> Option<Self::State>; fn display_outcome(
        &self,
        last_state: &Self::State,
        action: &Self::Action
    ) -> Option<String>
    where
        Self::State: Debug
, { ... }
fn next_steps(
        &self,
        last_state: &Self::State
    ) -> Vec<(Self::Action, Self::State)>
    where
        Self::State: Hash
, { ... }
fn next_states(&self, last_state: &Self::State) -> Vec<Self::State> { ... }
fn follow_fingerprints(
        &self,
        init_states: Vec<Self::State>,
        fingerprints: Vec<Fingerprint>
    ) -> Option<Self::State>
    where
        Self::State: Hash
, { ... } }

Defines how a state begins and evolves, possibly nondeterministically.

Associated Types

type State

The type of state upon which this machine operates.

type Action

The type of action that transitions between states.

Loading content...

Required methods

fn init_states(&self) -> Vec<Self::State>

Returns the initial possible states.

fn actions(&self, state: &Self::State, actions: &mut Vec<Self::Action>)

Collects the subsequent possible actions based on a previous state.

fn next_state(
    &self,
    last_state: &Self::State,
    action: &Self::Action
) -> Option<Self::State>

Converts a previous state and action to a resulting state. None indicates that the action does not change the state.

Loading content...

Provided methods

fn display_outcome(
    &self,
    last_state: &Self::State,
    action: &Self::Action
) -> Option<String> where
    Self::State: Debug

Summarizes the outcome of taking a step.

fn next_steps(
    &self,
    last_state: &Self::State
) -> Vec<(Self::Action, Self::State)> where
    Self::State: Hash

Indicates the steps (action-state pairs) that follow a particular state.

fn next_states(&self, last_state: &Self::State) -> Vec<Self::State>

Indicates the states that follow a particular state. Slightly more efficient than calling next_steps and projecting out the states.

fn follow_fingerprints(
    &self,
    init_states: Vec<Self::State>,
    fingerprints: Vec<Fingerprint>
) -> Option<Self::State> where
    Self::State: Hash

Determines the final state associated with a particular fingerprint path.

Loading content...

Implementors

impl<A: Actor<ModelId>> StateMachine for ActorSystem<A> where
    A::Msg: Clone + Debug + Ord,
    A::State: Clone + Debug + Eq
[src]

type State = ActorSystemSnapshot<A::Msg, A::State>

type Action = ActorSystemAction<A::Msg>

impl<State, Action> StateMachine for QuickMachine<State, Action>[src]

type State = State

type Action = Action

Loading content...