rustc --cfg foo
我如何在 cargo 中执行此操作?这就是 features
的用途吗?
功能似乎只适用于可选依赖项。
最佳答案
是的。 http://doc.crates.io/manifest.html#rules :
When a feature is selected, Cargo will call rustc with --cfg feature="${feature_name}". If a feature group is included, it and all of its individual features will be included. This can be tested in code via #[cfg(feature = "foo")]
关于rust - cargo 中的自定义 cfg 目标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28064409/