Reputation: 14730
I want to include features of a dependencies dependent on the activation of the feature in my library. If I compile with feature "serde"
, I want to install ndarray
with "serde"
support. And the default should be the default ndarray
install.
I' want something like this Cargo.toml
[features]
include-serde = ["ndarray-with-serde"]
[dependencies]
ndarray = { version = "0.x" }
ndarray-with-serde = { version = "0.x", features=["serde"] }
Is this possible at the moment?
Upvotes: 5
Views: 1276
Reputation: 14730
You can add the features of a crate after a /
.
[features]
myfeature = ["library_foo/bar", "libary_foo/ham"]
[dependencies]
library_foo = { version = "0.x" }
The snippet above install features "bar"
and "ham"
from "library_foo"
when "myfeature"
is activated.
Upvotes: 3