Hoping to get some pointers on best practices. Ideally I believe that I need specialization but in the mean time I’m wondering what the best practice is. This example shows what I need, i.e. different implementations for different types within a trait bound.
Instead of the
make function in the example above I actually have a builder type object and the only way I can get this to work is to define the builder
impl as a macro and then immediately call the macro for each type to fill in the
impl blocks, basically having an
impl for each type in the trait bound even though the implementations are the same.
This is kind of messy and has the same knock on effects on other types. Like I said, I think the solution is specialization, but until that lands what to people do the get around this?