With type ascription in patterns appearing plausibly-going-to-happen, I more than ever think that this is the right way for this to be consumed:
match x {
y: Ipv4Addr => ...,
z: Ipv6Addr => ...,
}
I don’t know the rest of the design, though
Perhaps the answer is that if the types are the same, it runs the first matching arm – like it would if you translated it into a sequence of downcasts off an any. And yes, that means you can’t use it place of Result
, but I think that’s fine in same way you can’t tell the difference between (r, g, b)
and (x, y, z)
in tuples the way you can between { r, g, b }
and { x, y, z }
in structs.