3 ms·
Having enum variants be structs has been proposed, and that could solve your issue if `mem::disciminant<Enum::Variant>` returned what you wanted.
by nynx 5y ago
Having enum variants be structs has been proposed, and that could solve your issue if `mem::disciminant<Enum::Variant>` returned what you wanted.
- yakubin 5y ago> Having enum variants be structs has been proposed That's great news. > that could solve your issue if `mem::disciminant<Enum::Variant>` returned what you wanted. I think you misunderstood, or I explained it poorly. Given an: enum Enum { A(int), B, } I would like mem::Discriminant<Enum> be the same type as if there was such a definition in code (illegal in Rust, because Rust doesn't have specializations): enum mem::Discriminant<Enum> { A, B, }
- nynx 5y agoAh, I did misunderstand. That’s an interesting idea.