我有以下内容:
comfy-table = { version = "7.1.1", default-features = false }
[features]
wasm = []
我想要:
wasm
功能未启用时,应启用tty
中的comfy-table
功能;和wasm
功能is启用了tty
中的comfy-table
功能,则应不启用。可以吗?
不,但是有两个不错的选择。首先,您可以使用
target_arch
: 来检测 WebAssembly
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
comfy-table = { version = "7.1.1", features = ["tty"], default-features = false }
[target.'cfg(target_arch = "wasm32")'.dependencies]
comfy-table = { version = "7.1.1", default-features = false }
其次,你可以反转你的特征:
comfy-table = { version = "7.1.1", default-features = false }
[features]
tty = ["comfy-table/tty"]