4 ms·
Rust has all that functionality, but as the author mentioned, they avoided using enums and match statements because it led to more runtime errors and they were
by chewbacha 6y ago
Rust has all that functionality, but as the author mentioned, they avoided using enums and match statements because it led to more runtime errors and they were specifically trying to incur compile time errors. This is why they choose to use trait objects and type definitions to control state transitions.
Edit: I invite you to learn more about the match keyword in rust and see how it relates to swift. I think you’ll find that it meets or exceeds your expectations: https://doc.rust-lang.org/book/ch06-02-match.html https://doc.rust-lang.org/book/ch06-02-match.html