Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upGuideline for which types need a FromStr impl #63
Comments
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
May 31, 2017
URL encoding? |
This comment has been minimized.
This comment has been minimized.
|
So:
Although, there are still at least two stdlib types that might be an exception to this: |
dtolnay
added
the
new guideline
label
Sep 18, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dtolnay commentedMay 18, 2017
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?