Struct extfsm::FSM [] [src]

pub struct FSM<ExtendedState, StateType, EventType, TransitionFnArguments, ErrorType> where
    StateType: Clone + Eq + Hash + Sized,
    EventType: Clone + Eq + Hash + Sized
{ pub extended_state: RefCell<Box<ExtendedState>>, // some fields omitted }

Final state machine type

Template parameters

  • ExtendedState - provides a structure that every transition can access and stores extended state
  • TransitionFnArguments - type that can be boxed as parameters to an event instance
  • ErrorType - Errors that transitions can generate internally

Fields

Methods

impl<ExtendedState, StateType, EventType, TransitionFnArguments, ErrorType> FSM<ExtendedState, StateType, EventType, TransitionFnArguments, ErrorType> where
    StateType: Clone + Eq + Hash + Sized,
    EventType: Clone + Eq + Hash + Sized
[src]

implementation of methods to contstruct the machine

new FSM with an initial extended state box'ed up so it can be passed around easily

provides output of the FSM in dot format

  • filename - optional filename

new transition

returns - TRUE if transition has been inserted, FALSE if a previous has been overwritten!

new enter/exit transition per state executed after the transition right before the state is entered. If the machine remains in the same state neither the enter nor the exit transitions are called

returns - TRUE if transition has been inserted, FALSE if a previous has been overwritten!

gives a read only peek into the extended state from the outside of transitions. Must be given up before running machine of course

check current state read-only

returns - TRUE if machine has outstanding events queued to process

Trait Implementations

impl<'a, ExtendedState, StateType, EventType, TransitionFnArguments, ErrorType> GraphWalk<'a, DotNodeKey<StateType>, DotEdgeKey<StateType, EventType>> for FSM<ExtendedState, StateType, EventType, TransitionFnArguments, ErrorType> where
    StateType: Clone + PartialEq + Eq + Hash + Sized,
    EventType: Clone + PartialEq + Eq + Hash + Sized
[src]

graphwalk

Returns all the nodes in this graph.

Returns all of the edges in this graph.

The source node for edge.

The target node for edge.

impl<'a, ExtendedState, StateType, EventType, TransitionFnArguments, ErrorType> Labeller<'a, DotNodeKey<StateType>, DotEdgeKey<StateType, EventType>> for FSM<ExtendedState, StateType, EventType, TransitionFnArguments, ErrorType> where
    StateType: Clone + PartialEq + Eq + Hash + Sized,
    EventType: Clone + PartialEq + Eq + Hash + Sized
[src]

graph labelling

Must return a DOT compatible identifier naming the graph.

Maps n to a unique identifier with respect to self. The implementer is responsible for ensuring that the returned name is a valid DOT identifier. Read more

Maps n to one of the [graphviz shape names][1]. If None is returned, no shape attribute is specified. Read more

Maps n to a style that will be used in the rendered output.

Maps e to arrow style that will be used on the end of an edge. Defaults to normal. Read more

Maps e to arrow style that will be used on the end of an edge. Defaults to no arrow style. Read more

Maps e to a style that will be used in the rendered output.

Maps n to a label that will be used in the rendered output. The label need not be unique, and may be the empty string; the default is just the output from node_id. Read more

Maps e to a label that will be used in the rendered output. The label need not be unique, and may be the empty string; the default is in fact the empty string. Read more

impl<ExtendedState, EventType, StateType, TransitionFnArguments, ErrorType> RunsFSM<EventType, StateType, TransitionFnArguments, ErrorType> for FSM<ExtendedState, StateType, EventType, TransitionFnArguments, ErrorType> where
    StateType: Clone + PartialEq + Eq + Hash + Debug + Sized,
    EventType: Clone + PartialEq + Eq + Hash + Debug + Sized,
    ErrorType: Debug
[src]

add events to the event queue @ the back, events are not processed

process the whole event queue. Observe that this can generate multiple messages and queue events against the FSM itself again so don't rely which state the machine ends up in Read more