Guideline for which types need a FromStr impl #63
Replies: 3 comments
-
I would include any type that's likely to be passed via a command line flag/environment variable/non-structured config item. Having a generic way to parse values in all those places really makes getting the data you need into an application easy. |
Beta Was this translation helpful? Give feedback.
-
URL encoding? |
Beta Was this translation helpful? Give feedback.
-
So:
Although, there are still at least two stdlib types that might be an exception to this: |
Beta Was this translation helpful? Give feedback.
-
Some types should have Display but not FromStr, for example most error types. What determines whether a type should support FromStr? Examples to generalize:
Also the FromStr impl should match the Display impl. Are there any exceptions to this?
Beta Was this translation helpful? Give feedback.
All reactions