问题
I'm writing a library in Cargo. If this library depends on another library like libc, which exposes a feature (in this case, use_std
), how do I make a feature I expose enable or disable that feature in my dependency?
Looking at the cargo documentation, it looks like there's no official way specified to do this.
回答1:
From the documentation you linked to:
# Features can be used to reexport features of other packages. The `session` # feature of package `awesome` will ensure that the `session` feature of the # package `cookie` is also enabled. session = ["cookie/session"]
Is that sufficient?
来源:https://stackoverflow.com/questions/40021555/how-do-i-pass-down-feature-flags-to-subdependencies-in-cargo