Prefer TryInto over TryFrom in builders #727
Labels
A-request
Area: Request
A-response
Area: Response
E-easy
Effort: easy. Start here :D
S-feature
Severity: feature. This adds something new.
I have been looking at the API for this crate as someone relatively new to Rust.
Amongst the code, I noticed this method deceleration for the requests::Builder struct
Initially I was confused as to the reasoning that a constraint on
Method
was defined here.Since
Method
seems to be unused in the function signature.After looking deeper I realize the point of this constraint is to limit
T
to values that can be converted toMethod::try_from
.Is there any reason that the where clause doesn't use the reciprocal trait
TryInto
instead?For example,
Idk about others but this would have been clearer to me.
I was curious if there was a reason as to why the original was chosen over this second solution, which I think is more clear(imo).
The text was updated successfully, but these errors were encountered: