Frowading feature set to dependent Crates


#1

H there:
I recently added some profiling to my library using Flame, great tool there.
The problem arises when I want to hide the instrumentation by using an optional feature:
my Crate.toml looks then like:

[dependecies]
flame = { version = "^0.1.9", optional = true }
flamer = { version = "^0.1.4", optional = true }
inner_lib = { path = "inner_lib" }

[features]
default = []
profile = ["flame", "flamer"]

When I want to profile the inner_lib crate, I just write:
inner_lib = [ path = "inner_lib", features=["profile"] }

But now the inner lib is compiled with profile instrumentation even when the outer is not using it, and I do not want to pay the price in a library which is meant to be the backend of my computations.

Is it there any way to forward the feature only when I need it?
Thanks


#2

Yep:

[features]
profile = ["flame", "flamer", "inner_lib/profile"]