Re-export Dependency Features

Is it possible to 're-export' a dependency feature in your crate so usrs can set the feature on that dependency?

So something like:

Crate A:

[features]
Feat = []

Crate B:

[features]
Feat = [ "A.Feat"]

[dependencies]
A = "*"

So a user of B could set Feat on A.

Assuming that a has a feature feat-a, and b has a (normally default) feature feat-b.

[features]
default = ["feat-b"]
feat-a = "a/feat-a"
feat-b = "b/feat-b"

[dependencies]
a = "0.1.0"
b = { version = "0.1.0", default-features = false }

Of course, you should also be able to do this from the command line, with something like --features=a/feat-a.

2 Likes