3 ms·
Not Rust but I often find with ADT's + Pattern matching I end up with a state machine without even attempting to write a state machine. ADT's + pattern matchin
by tiew9Vii 6y ago
Not Rust but I often find with ADT's + Pattern matching I end up with a state machine without even attempting to write a state machine.
ADT's + pattern matching make it a very easy pattern to implement. If your language supports exhaustive pattern matching it's also a very easy way to leverage the compiler to find bugs in your logic.