Is there any way to use GATs to achieve a particular use case of ah-hoc/anonymous enums[0]? Say if library L1 returns enum A|B, L2 operates on enum A|B, and main wants to pass enum A|B from L1 to L2, with the kicker being A, B are concrete in main. I'm not interested in distinguishing between multiple appearances of the same type as in the RFC example, so rather like: let foo: (~str|int) = (_|666); match foo { (s: st…
You might be interested in Rust's either crate (not built-in): https://docs.rs/either/latest/either/
This parallels a similar solution to the nominal sum types I ended up making for Java (Either, Option3, etc) with these generic types in a common shared library and other libraries and consumers of both accessing the shared type.
One more question: In Rust is Either type-erased, specializations generated, or something else?