我有A
和B
的板条箱。 A
取决于B
,并且B
具有名为some_feature
的功能。
我可以通过运行B
来使用货运来构建cargo build --features=some_feature
,但是如何为A
设置相同的功能,我可以选择为基础启用或禁用some_feature
编译B
时将A
放在箱子里吗?
答案 0 :(得分:1)
您可以简单地转发A
中指定的功能:
# A/Cargo.toml
[features]
some-feature = ["B/some-feature"]
[dependencies]
B = "*"
如果您将B
传递给--features=some_feature
,它将用--features=some_feature
编译A
。
答案 1 :(得分:0)
您只需要配置清单,就像doc这样简单:
[dependencies.awesome]
version = "1.3.5"
default-features = false # do not include the default features, and optionally
# cherry-pick individual features
features = ["secure-password", "civet"]