by ttoinou · 11mo ago · 0 comments
What does it mean when loading is false, error is Some, and data is also Some? The type allows nonsense. You write defensive checks everywhere. Every render must guess which combination is real
How about you never write the wrong state in the first place ? Then you have nothing to take care ofIndeed, and tagged unions (enums in Rust) explicitly allow you to avoid creating invalid state.