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
Generic derive support #3023
Generic derive support #3023
Conversation
At the moment no additional trait bounds are added to the impls, so one should put necessary trait bounds on the type definition itself: #[derive(Parser)]
struct Opt<T: Args> {
#[clap(flatten)]
inner: T,
} |
Looks good as it is for a phased approach. But this doesn't completely close the original issue. I think the trait bounds can be inferred with some extra logic in our derive implementation. |
Trait bounds can be inferred, sure, but:
|
Our issue and the linked structopt PR both have explicit trait bounds. If you are referring to my comment, I can't remember what else I was referring to. As long as we can cleanly port over structopt's test cases, it seems like this is sufficient for merging and closing out our issue which will help us be feature parity with structopt when we release so people can port to clap3 more easily. |
@epage I have ported tests from structopt. Helped me notice I forgot Parser implementation for enums. One of the changes needed compared to While |
@pksunkara the tests are showing parity with structopt. Any further concerns? |
bors r+ I didn't realize that #2769 is purely a parity issue. In that case, yeah this is good enough to close that. But, should we create a new issue to discuss further improvements to these generics about inferring trait bounds? |
Created #3032 |
Build succeeded: |
This is a port of clap-rs/clap#3023
Closes #2769
Unresolved questions: