I have the following:
comfy-table = { version = "7.1.1", default-features = false }
[features]
wasm = []
I want:
wasm
feature is not enabled the feature tty
in comfy-table
should be enabled; andwasm
feature is enabled the feature tty
in comfy-table
should not be enabled.Is it possible?
No, as features are additive, but there are two good alternatives. First, you could detect WebAssembly by using target_arch
:
[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 }
(for completeness, note that you can try any(target_arch = "wasm32", target_arch = "wasm64")
if the unstable 64-bit version of WebAssembly might be used)
Second, you could invert your feature:
comfy-table = { version = "7.1.1", default-features = false }
[features]
tty = ["comfy-table/tty"]