finds.dev← search

// the find

mdeloof/statig

★ 783 · Rust · MIT · updated Nov 2025

Hierarchical state machines for designing event-driven systems

statig is a hierarchical state machine library for Rust, targeting embedded and no_std environments. It models UML statecharts with proper entry/exit actions and superstate event bubbling. Aimed at firmware developers and anyone building event-driven systems who wants more structure than a match statement but less overhead than a full framework.

State-local storage is genuinely well thought out — data lives in the enum variant, not an Option<T> on the shared struct, so you can't access it when it doesn't exist. The macro is additive: it generates code alongside yours rather than replacing it, and the no-macro path is fully supported and documented. no_std + no-alloc support is real, not just a checkbox — states live in ROM. The introspection hooks (before/after dispatch and transition callbacks) are a good practical addition for debugging embedded firmware where you can't just attach a debugger.

783 stars in two-plus years suggests limited adoption, which means sparse community resources and real-world battle testing outside the author's own use cases. History states (returning to the last active substate) exist as an example but aren't a first-class concept in the API — you wire it yourself. The async support requires the entire state machine to be async; you can't mix sync and async states, which is awkward in executor-heavy embedded async runtimes like Embassy. No built-in serialization of state for persistence or debugging — serde support is tested but appears to be opt-in glue code the user must write.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →