Is is possible to create a Enum::Pair from a (u8, u8)?
let pair = (3,4);
let variant = Enum::Pair(pair);
This doesn't work because Enum::Pair() expect 2 arguments. I don't think that rust as the equivalent of the star operator in python either. Is there another way to do it?
The underlying problem here is that the type of the anonymous tuple let pair = (3,4), which might be realized as a pair of i32s, is different from the type of the enum variant Enum::Pair, which is composed of u8s.
If you don't need to do this very often you could just decompose the tuple manually and recompose it as the desired variant:
let variant = Enum::Pair(pair.0, pair.1);
Edit: That doesn't work without a type coercion, since pair.0 might be an i32 rather than a u8.
You can sort of emulate the Python star operator by using the unstable function traits directly, because they currently represent their arguments as a single tuple.