Expand description
Implementation of a generic finite state machine with extended state. Features worth mentioning:
- optional exit/enter transitions on states
- each event instance can provide boxed arguments to transiton closure
- each transition closure can return with vector of arguments that are queued at the end of outstanding events queue
- can generate dot representation of itself, edges are grouped on color and annotated with events and optional names to provide readable, dense representation for dense graphs
Author
Tony Przygienda, 2016
Examples
Check out the tests in the implementation for a good example of use
Panics
Never
Errors
refer to Errors
Copyrights
Copyright (c) 2017, Juniper Networks, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. This code is not an official Juniper product. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Structs
Enums
Traits
Type Definitions
FSMTransitionFn
. StateType
passed in is previous state before currently entered or
exited state. EventType
is indicating which event causes the enter or exit.
This allows to track where an FSM entered or exited a state from which can be of
high interest in “stable” states of the FSM.
In case of Entry on the first state it may be all None
.