Passing "feature requirement" to child crates

  1. I have crate-foo and crate-bar.

  2. crate-bar depends on crate-foo

  3. crate-foo has a section that looks like

default = []
gpu = [ ... ]
  1. Now, for crate-bar, I want to somehow specify a GPU feature in the following way:

4a. if crate-bar has gpu enabled, then it pulls in gpu-enabled crate-foo. If crate-bar does NOT have gpu enabled, then it pulls in non-gpu-eanbled crate-foo.

  1. Is there a way to achieve the above?

I think this is what you need:

# 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"]


This solved the problem. Thanks!