Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for default option is confusing #32

Open
ssokolow opened this issue Jun 13, 2020 · 0 comments
Open

Documentation for default option is confusing #32

ssokolow opened this issue Jun 13, 2020 · 0 comments

Comments

@ssokolow
Copy link

ssokolow commented Jun 13, 2020

Currently, if I add a default = "8000" to my port: Option<u16> without removing the Option, it gives the following error message.

the trait `std::str::FromStr` is not implemented for `std::option::Option<u16>`

I found this extremely confusing because I didn't try compiling it before adding the default and the documentation doesn't mention that adding default will narrow the set of valid type signatures, and the Option<i32> example from the docs was also breaking.

(I went in circles double-checking these examples for 15 minutes and looking at the FromStr API docs before it occurred to me that maybe default altered the set of valid types.)

The documentation for default should be amended to mention this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant