例如,我定义了2个没有依赖关系的特性:
[features]
default = []
py2 = []
py3 = []
基于所选功能(--features py3
)我想为依赖项启用不同的功能(cpython
):
[dependencies.cpython]
default-features = false
# features = ["python27-sys"] I want to select this if py2 is enabled
features = ["python3-sys"]
optional = true
我可以这样做吗?或者我也可以从命令行中为依赖项选择功能吗?
答案 0 :(得分:5)
讨论了here。可以使用/
来完成。
[features]
default = []
py2 = ["cpython", "cpython/python27-sys"]
py3 = ["cpython", "cpython/python3-sys"]
unstable = []
[dependencies.cpython]
# git = "https://github.com/dgrunwald/rust-cpython.git"
default-features = false
optional = true
我在文档或官方网页上都没有看到它。