2 ms·
Hmm, I don't use Zig so can't say much about it.
by Hirrolot 6y ago
Hmm, I don't use Zig so can't say much about it.
- flohofwoe 6y agoThis is what it looks like in Zig: https://ziglang.org/documentation/master/#Tagged-union https://ziglang.org/documentation/master/#Tagged-union You create two types, a tag enum, and the tagged union itself, which has a typed "payload" for each tag. Plus the necessary "syntax sugar" for initialization and extracting the payload by tag.