You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
It seems logical that (A, B) where A: Enum, B: Enum would be basically the same as a struct's derivation, which is a cartesian product. I don't think we're allowed to implement this ourselves as tuples are always a foreign type, but it could be implemented for up to some length of tuples in the crate.
I personally want this so that I can produce enums via this utility function I've made:
I don't think this is possible to implement without generic_const_exprs nightly feature if I want to support enum maps of arbitrary types, and I have to no idea whether it would make sense to implement Enum only.
That said, a valid workaround if you know what enum cross-product you want would be define your own structure that holds both enums.
#[derive(Enum)]structProduct(A,B);
Alternatively it's possible to nest enum maps: EnumMap<A, EnumMap<B, _>>.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It seems logical that
(A, B) where A: Enum, B: Enum
would be basically the same as astruct
's derivation, which is a cartesian product. I don't think we're allowed to implement this ourselves as tuples are always a foreign type, but it could be implemented for up to some length of tuples in the crate.I personally want this so that I can produce enums via this utility function I've made:
without having to nest the
enum_iter
calls if there's multiple which I want to produce from.(Side note: the
enum_iter
function might also be useful to have put in.)I could make an MR if it's an amenable feature to include.
The text was updated successfully, but these errors were encountered: