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

suggested API improvement: make Arg::possible_values() more flexible #87

Closed
Byron opened this issue Apr 29, 2015 · 4 comments
Closed

suggested API improvement: make Arg::possible_values() more flexible #87

Byron opened this issue Apr 29, 2015 · 4 comments
Labels
C-enhancement Category: Raise on the bar on expectations M-breaking-change Meta: Implementing or merging this will introduce a breaking change.

Comments

@Byron
Copy link
Contributor

Byron commented Apr 29, 2015

Currently it enforces the usage of Vec<&str>, which makes it harder to use for people who prefer different means of passing this information. They could have a statically allocated array for instance, which contains enumerations, which in turn implement AsRef<str> to allow a light conversion.

I suggest to have a look at this method's signature which uses an iterator over items that convert into a &str, allowing all sorts of inputs. Internally, you can still easily create the Vec you require by using Iterator::collect()

@kbknapp kbknapp added the C-enhancement Category: Raise on the bar on expectations label Apr 29, 2015
@kbknapp
Copy link
Member

kbknapp commented Apr 29, 2015

Thanks for the suggestion! I'll get to work on this as this is an issue I thought about tackling with #53 I'll post back here with the changes 👍

@Byron
Copy link
Contributor Author

Byron commented Apr 29, 2015

Awesome ! You are fast :) !

Byron added a commit to Byron/google-apis-rs that referenced this issue Apr 29, 2015
We will try to wait for clap-rs/clap#87
to allow us to use the enumeration instead of strings, as well as
an iterator, which will look more idiomatic in the end.
@kbknapp kbknapp added the M-breaking-change Meta: Implementing or merging this will introduce a breaking change. label Apr 29, 2015
@kbknapp
Copy link
Member

kbknapp commented Apr 29, 2015

I just finished this, I'm committing it to master, and once I finish a few of these other issues I will bump the crates.io version.

@Byron
Copy link
Contributor Author

Byron commented Apr 29, 2015

Great, I will use it right away from master, as it helps me to get feature complete in regards to argument parsing. But for today, I am totally done, empty even :D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Raise on the bar on expectations M-breaking-change Meta: Implementing or merging this will introduce a breaking change.
Projects
None yet
Development

No branches or pull requests

2 participants