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

docs: update return signature for try_from_os_str #3818

Merged
merged 2 commits into from Jun 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/derive_ref/README.md
Expand Up @@ -268,7 +268,7 @@ You can then support your custom type with `#[clap(parse(<kind> [= <function>]))
| `from_str` | `fn(&str) -> T` | `::std::convert::From::from` |
| `try_from_str` (default) | `fn(&str) -> Result<T, E>` | `::std::str::FromStr::from_str` |
| `from_os_str` | `fn(&OsStr) -> T` | `::std::convert::From::from` |
| `try_from_os_str` | `fn(&OsStr) -> Result<T, OsString>` | (no default function) |
| `try_from_os_str` | `fn(&OsStr) -> Result<T, String>` | (no default function) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was trying to use OsString I was unable to compile with the error error[E0277]: OsString doesn't implement std::fmt::Display . Changing the error type to String fixed this.

Sounds like this should be E like try_from_str's signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in the latest commit

| `from_occurrences` | `fn(u64) -> T` | `value as T` |
| `from_flag` | `fn(bool) -> T` | `::std::convert::From::from` |

Expand Down