4 ms·
Do you have a compelling use case? I can't imagine a use for untagged unions in Rust that isn't subsumed by other features in the language.
by jroesch 11y ago
Do you have a compelling use case? I can't imagine a use for untagged unions in Rust that isn't subsumed by other features in the language.
- mbrubeck 11y agoThe most common use case would be interop with C libraries that use untagged unions. This is a significant hassle when writing C bindings in Rust today.
- Jweb_Guru 11y agoI can think of many, mostly revolving around cases where the tag is not stored inline with the structure in question. Where space efficiency is important this is quite common. C interoperability is obviously another important use case (the current solution of passing around [u8] arrays is pretty atrocious).