3 ms·
I've been experimenting with Rust's Rocket webapp framework, and as much as I like it, I agree it's very annoying how a struct can't permit nulls in one context
by pjungwir 6y ago
I've been experimenting with Rust's Rocket webapp framework, and as much as I like it, I agree it's very annoying how a struct can't permit nulls in one context but not another. I wish there were an easy solution that didn't require near-identical struct definitions and excess copying memory from one place to another.
- wtetzner 6y agoSeems like a good opportunity for a custom derive.
- sdfsfsf3kjdf 6y agoIn Rust you can solve this via derive or a macro. Typescript's conditional types and the associated utility types are a nice solution to this problem as well. You can do a ton with Partial, Required, Pick, Omit, Exclude etc.
- pjungwir 6y agoThank you both for these tips. I'll see what I can figure out! :-)