gpt4 book ai didi

rust - 我如何将 'pass down' 功能标志标记为 Cargo 中的子依赖项?

转载 作者:行者123 更新时间:2023-11-29 07:43:07 27 4
gpt4 key购买 nike

我正在用 Cargo 编写一个库。如果此库依赖于另一个库,如 libc ,它公开了一个功能(在本例中为 use_std),如何使我公开的功能在我的依赖项中启用或禁用该功能?

查看 cargo documentation ,似乎没有指定执行此操作的官方方法。

最佳答案

来自 the documentation you linked to :

# 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"]

够了吗?

关于rust - 我如何将 'pass down' 功能标志标记为 Cargo 中的子依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40021555/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com