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
Allow borrowing an enum variant as a tuple of the same types, so that you can use methods already defined on a tuple with those types.
enum Pair<A,B> {
Nothing,
Two(A, B),
}
let p: Pair<A, B>;
match p {
Two(a, b) => (a, b).iter_bytes()
}
This would allow dispatching methods without cloning the Enum variant.
Dispatching tuple methods allow enum impls to re-use functions that are already generically defined over tuples for all type combinations (for example IterBytes).
In a way, it's a simple way to manually do the work of the deriving directive, by reusing the tuple implementation.