#fsm #state #state-machine

extfsm

Extended Finite State Machine with internal event queue and entry/exit transitions

11 releases (7 breaking)

Uses old Rust 2015

0.12.1 Jan 30, 2022
0.11.0 Oct 24, 2018
0.10.0 Oct 3, 2018
0.8.0 Apr 29, 2018
0.5.2 Jul 13, 2017

#264 in Algorithms

Download history 3/week @ 2022-01-11 2/week @ 2022-01-18 18/week @ 2022-01-25 7/week @ 2022-02-01 1/week @ 2022-02-08 1/week @ 2022-02-15 12/week @ 2022-02-22 2/week @ 2022-03-01 2/week @ 2022-03-08 33/week @ 2022-03-15 33/week @ 2022-03-22 1/week @ 2022-03-29 1/week @ 2022-04-05 68/week @ 2022-04-26

70 downloads per month

Apache-2.0

71KB
1.5K SLoC

Extended Finite State Machine in Rust

crates.io Travis Build Status Coverage Status

Introduction

Library to support programming of Extended Finite State Machines (FSM) in Rust. The machine is not necessarily built for fastest zero-copy speed but greatest flexibility and maintanability. Non zero-copy design has been chosen since after event processing it stores state and passes control back out which would make management of lifetimes very onerous on the user otherwise.

FSMs are from long engineering experience the cleanest way to implement asynchronous protocols between components.

Features

  • internal event queue allows a machine to post events against itself on transition completion
  • supports optional transition per state entry/exit
  • events can carry dynamic arguments accessible when transition is executed
  • machine generates its own .dot graphs easily converted into .pdf or .svg supporting colored edges and summarizing edges for same start and end state transitions
  • slog debugging support
  • machine's extended state can be examined when not processing events
  • machine transitions can be traversed read-only
  • flyweight pattern to run many instances of same FSM with different extended state

License

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.

Dependencies

~1MB
~15K SLoC