5 ms·
Good point, this is where Rust's flexible enums are an advantage relative to C-style. If you'll forgive the Haskell syntax, you can have something like: d
by maxcan 11y ago
Good point, this is where Rust's flexible enums are an advantage relative to C-style. If you'll forgive the Haskell syntax, you can have something like:
data StatusCoode
= Ok200
| Missing404
| Error500
| OtherStatusCode Int
To rephrase the slogan a bit - make an illegal state a bit more difficult to represent or at least the risk of an illegal state clear to the programmer.
- steveklabnik 11y agoExactly: https://github.com/hyperium/hyper/blob/master/src/status.rs#L31-L221 https://github.com/hyperium/hyper/blob/master/src/status.rs#...
- maxcan 11y agoMy bad.. I was just basing my comment off the readme. In general, I love what you guys are doing and my team is looking closely at Rust and Leaf.
- steveklabnik 11y agoNo worries! I just meant to confirm your suspicions :)