how do i add a dependency with all its features enabled?
It's up to the library author(s) if they want to support such use case.
For most libraries, features add functionality for very specific use cases, like interoperation with a particular other library. Activating all features will just increase your compile times to little benefit. It may even cause compilation to fail (e.g. a feature not supported for the target, or which requires some external native library or other dependency).
Features can even be mutually exclusive (they can enable different functionalities under the same API or change the way functions work). It another compile-time error case.
You have to list them all. There's no shortcut for this.
docs.rs has a Feature Flags in the menu, where you can find what you can enable:
That is a misuse of features. Sometimes, it is the least bad option, but it is a misuse of features.
A consequence of this is that features should be additive. That is, enabling a feature should not disable functionality, and it should usually be safe to enable any combination of features. A feature should not introduce a SemVer-incompatible change.
Note that Cargo does have an --all-features
flag, commonly used by rustdoc
, but it only applies to your crate, not your dependencies.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.