作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是库箱的 Cargo.toml。它通过对板支持 crate board-a
具有可选依赖关系来支持两个不同的嵌入式板。和 board-b
,并且通过运行 cargo build --features target-a
仅选择其中一个.
还有一个通用的第三方模块,可以选择使用const-fn
特征。此选项在库 crate 中公开:
[dependencies]
common = {...}
board-a = {optional=true, ...}
board-b = {optional=true, ...}
[features]
const-fn = ["common/const-fn"]
target-a = ["board-a"]
target-b = ["board-b"]
board-a
和
board-b
crate 也有可选的
const-fn
功能,我想向图书馆箱子的用户公开这些选项?我可以在不创建
target-a-const-fn
的情况下执行此操作吗?和
target-b-const-fn
特征?我公开的可选功能越多,或者我们支持的板越多,这显然会变得非常困惑。
const-fn
两个 crate 中的功能拉——只应使用选定的一个,否则会不必要地增加下载和编译时间。理想情况下,我想要与以下内容等效的东西,但据我所知,没有任何东西存在:
[features]
const-fn = ["common/const-fn", "board-a/const-fn" if target-a, "board-b/const-fn" if target-b]
target-a = ...
最佳答案
不,目前 Cargo 不支持此功能,尽管有 a tracking issue对于这个功能。
关于rust - Cargo 功能是否可以启用可选依赖项中的功能而不强制激活这些 crate ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52825268/
我正在尝试用 Swift 编写这段 JavaScript 代码:k_combinations 到目前为止,我在 Swift 中有这个: import Foundation import Cocoa e
我是一名优秀的程序员,十分优秀!