zlacker

[return to "Patterns for Defensive Programming in Rust"]
1. J_Shel+Bv[view] [source] 2025-12-05 18:52:21
>>PaulHo+(OP)
Wow that’s amazing. The partial equality implementation is really surprising.

One question about avoiding boolean parameters, I’ve just been using structs wrapping bools. But you can’t treat them like bools… you have to index into them like wrapper.0.

Is there a way to treat the enum style replacement for bools like normal bools, or is just done with matches! Or match statements?

It’s probably not too important but if we could treat them like normal bools it’d feel nicer.

◧◩
2. tayo42+0h3[view] [source] 2025-12-06 20:03:38
>>J_Shel+Bv
I think you can do something like impl defref but not sure that's a good idea hah. Maybe it's a different trait I'm thinking of
[go to top]