Cargo: 记录如何有条件地启用依赖项中的功能

创建于 2018-03-07  ·  3评论  ·  资料来源: rust-lang/cargo

features部分中的/语法似乎没有记录。

A-documenting-cargo-itself

最有用的评论

对于来这里谷歌搜索的其他人:

[dependencies]
othercrate = "1.2.3"

[features]
myfeature = ["othercrate/otherfeature"]

所有3条评论

对于来这里谷歌搜索的其他人:

[dependencies]
othercrate = "1.2.3"

[features]
myfeature = ["othercrate/otherfeature"]

是吗? 清单参考文档(链接)中的[features]部分有示例:

# Features can be used to reexport features of other packages. The `session`
# feature of package `awesome` will ensure that the `session` feature of the
# package `cookie` is also enabled.
session = ["cookie/session"]

(自该功能在 #712 中推出以来一直存在)

乐观地关闭这只是错过了(我认为 mdbook 搜索在 3 月份还没有出现)。 如果这仍然需要工作,我们可以重新开放。

如果cookie是可选的,这如何工作?

此页面是否有帮助?
0 / 5 - 0 等级