Several Tree methods (insert being the most obvious) have an interface like this:
fn modify<V>(&self, value: V)
where IVec: From<V> { ... }
I propose changing these to where V: Into<IVec>, for the following reasons:
Into<T> can be implemented but T: From<U> cannot.V, the input parameter type, which personally I find to be cleaner than an indirect bound on IVec.Into<T> is more common in Rust APIs [citation needed].T: From<U> implies U: Into<T>.I'm happy to go through and make this change myself, but I wanted to first propose the change and get feedback / approval.
@Lucretiel yeah that's a good point, I think I just had the blanket recommendation of "use From not Into" into my head without thinking at all, not remembering that recommendation is for implementing the traits themselves rather than interfaces which accept them.
I'd gladly accept that change as long as it doesn't cause gnarly API breakage in some unforeseen way, which I don't think will happen!
Great! Can you assign this bug to me so that I don't lose track of it?
Sure!
Most helpful comment
@Lucretiel yeah that's a good point, I think I just had the blanket recommendation of "use From not Into" into my head without thinking at all, not remembering that recommendation is for implementing the traits themselves rather than interfaces which accept them.
I'd gladly accept that change as long as it doesn't cause gnarly API breakage in some unforeseen way, which I don't think will happen!