Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've only really used state machines in TypeScript via xstate, and I've been meaning to try Rust for a while, so your comment interests me. Got any tips or advice on further reading or specific libs that you can recommend for working with FSMs in Rust?


Look at how you'd do it in f#, ocaml, or elm first imo. The type systems of those languages allow for a very tight approach with no confounding factors. The way rust does it is the same, but with more details leaked in from the constraints rust imposes. Which is fine, but I think it's valuable to see the "pure" stripped back form in a language almost perfectly suited to it first.


I don't have much Rust-specific experience, but I wonder if you need a library for this when the language/compiler is doing all the heavy lifting. When working with Elm, for example, that uses that a lot for the Model-View-Update framework, you just define your model states and pattern match them to build the view and update functions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: