We have a structure A with a type parameter for which we use two selector types T and U, i.e., A and A have different implementations of a trait (which trait is not fundamental for the problem).
Our problem is that we need to specialize the Drop implementation to T vs U and Drop cannot be specialized.
Currently we are using a DropHelper trait containing the method depending on T vs U, and T and U implement it. By bounding the type parameter of S to DropHelper we can then call the method from the Drop implementation: playground.
However, this approach has the downside of adding a trait bound to the type parameter, which is inconvenient as we have to propagate it around in some cases.
Any alternatives?