3 ms·
> My opinion is that FSMs are best implemented on a higher abstraction layer than directly in code itself. I really love Rust async/await for this. Under the h
by jgraettinger1 6y ago
> My opinion is that FSMs are best implemented on a higher abstraction layer than directly in code itself.
I really love Rust async/await for this. Under the hood, the compiler is simply assembling a big FSM, and polling a Future is equivalent stepping through allowed transitions which are available to it.
You can even use this to build FSMs which are designed to be manually driven, by coordinating generator inputs and outputs via RefCell and one-shot channels and calling `poll` yourself.