Add to Derive Reference an example of what a derive exapnds to
Author: epageCreated Feb 28, 2022Updated Aug 20, 2026
LabelsC-enhancementA-docsE-easy
Please complete the following tasks
- I have searched the discussions
- I have searched the open and rejected issues
Clap Version
3.1.0
Describe your use case
In the derive reference, we try to explain the principles for how the derive works so people can use any part of the builder documentation as part of the derive but we still frequently get questions on how to use a feature.
Describe the solution you'd like
A more concrete example of the principles will hopefully help.
We shouldn't just run cargo expand but show it as idiomatic.
We should include
- Command methods
- Arg methods
- Subcommands
- PossibleValue methods
Alternatives, if applicable
No response
Additional Context
No response
Source: clap-rs/clap