Skip to main content

state_machines_rs/
lib.rs

1//! Compositional discrete-time state machines, after MIT 6.01 chapter 4.
2//!
3//! Every machine implements [`StateMachine`]: a pure `(state, input) -> (state, output)`
4//! transition plus a starting state. Mutation lives in [`Runner`]. Machines compose
5//! with [`Cascade`], [`Parallel`], [`Feedback`], and friends; terminating machines
6//! (TSMs) sequence with [`Repeat`], [`Sequence`], [`Until`], and [`RepeatUntil`].
7//!
8//! [`Cascade`]: combinators::Cascade
9//! [`Parallel`]: combinators::Parallel
10//! [`Feedback`]: combinators::Feedback
11//! [`Repeat`]: tsm::Repeat
12//! [`Sequence`]: tsm::Sequence
13//! [`Until`]: tsm::Until
14//! [`RepeatUntil`]: tsm::RepeatUntil
15
16pub mod combinators;
17pub mod core;
18pub mod defined;
19pub mod ext;
20pub mod primitives;
21pub mod rng;
22pub mod tsm;
23
24pub use crate::core::{Runner, StateMachine};
25pub use crate::defined::{Defined, SafeAdd, SafeMul, SafeSub};
26pub use crate::ext::SMExt;
27pub use crate::rng::{Rng, SplitMix64};