-
Notifications
You must be signed in to change notification settings - Fork 420
Minor API proposal: change From to Into #999
Copy link
Copy link
Closed
Description
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:
- It allows a slightly larger set of input types, as there are rare cases where
Into<T>can be implemented butT: From<U>cannot. - It allows the trait bound to be on
V, the input parameter type, which personally I find to be cleaner than an indirect bound onIVec. - Generally, using
Into<T>is more common in Rust APIs [citation needed]. - This is a strictly forwards-compatible change, because
T: From<U>impliesU: 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels