Skip to main content

Crate state_machines_rs

Crate state_machines_rs 

Source
Expand description

Compositional discrete-time state machines, after MIT 6.01 chapter 4.

Every machine implements StateMachine: a pure (state, input) -> (state, output) transition plus a starting state. Mutation lives in Runner. Machines compose with Cascade, Parallel, Feedback, and friends; terminating machines (TSMs) sequence with Repeat, Sequence, Until, and RepeatUntil.

Re-exports§

pub use crate::core::Runner;
pub use crate::core::StateMachine;
pub use crate::defined::Defined;
pub use crate::defined::SafeAdd;
pub use crate::defined::SafeMul;
pub use crate::defined::SafeSub;
pub use crate::ext::SMExt;
pub use crate::rng::Rng;
pub use crate::rng::SplitMix64;

Modules§

combinators
Combinators that wire state machines together.
core
The StateMachine trait and its Runner.
defined
The Defined / SafeAdd / SafeMul machinery that models the chapter’s 'undefined' sentinel. Feedback combinators probe a machine with an undefined input first to discover its output; primitives must propagate undefined through arithmetic without crashing.
ext
Builder-style extension trait for composing machines fluently.
primitives
Primitive state machines.
rng
Minimal RNG trait and a reference implementation.
tsm
Terminating state machines (TSMs) and their combinators.