try
clap = { version = "4.3", features = ["derive"] }
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Credits
try
clap = { version = "4.3", features = ["derive"] }
Thanks a lot. That's it. But, what have I done now ๐ ? I believe I misunderstand the dependency inclusion. I have to learn something about features and why they aren't activated by default.
a crate may contain may different parts, and you may not always want all of them to avoid bloat. For an example, a crate may contain a sync and an async version, but you will probably only want one of them. So then the crate exposes the different parts as features. In clap they have defined the default features as:
default = ["std", "color", "help", "usage", "error-context", "suggestions"]
So, then if you need to use functionality not included there, then you have to specify it in your features list. On https://docs.rs/crate/clap/latest you can find a drop down in the top menu with Feature Flags, then they also have the documentation for the feature flags here https://docs.rs/clap/latest/clap/_features/index.html
That was really helpful, thanks.
The tutorial makes a reference to this
This requires enabling the derive feature flag.
But if you aren't as familiar with feature flags, this isn't as helpful.
More specifically on the front page we have
$ cargo add clap --features derive
Maybe we should push that down into the tutorial...
That's the point. I didn't know about the feature flags feature of Rust/Cargo. Of course, if you know it, you "have to" skip it in each tutorial. IMHO, it should be okay ๐ Thank you for your answer.