My project has crate A
and crate B
defined. Crate B defines a feature b_feature
:
# B/Cargo.toml
[features]
b_feature = []
Crate A
depends on crate B
. I would like to use b_feature
in the code of crate A
without introducing new feature in crate A
:
// Code in crate A
#[cfg(feature = "<some path to b_feature>")]
// Conditionally compiled code below
Is this at all possible? Ideally I would like to do something like this:
// Code in crate A that directly checks b_feature in B
#[cfg(feature = "<B/b_feature>")]
// Conditionally compiled code below
I am trying to avoid a situation where I have to 'reintroduce' feature
in crate A
:
# A/Cargo.toml
[dependencies]
B = ...
[features]
b_feature = ["B/b_feature"]