How to require/build dependencies for the specific feature enabled only?

⚓ Rust    📅 2025-09-12    👤 surdeus    👁️ 11      

surdeus

Warning

This post was published 61 days ago. The information described in this article may have changed.

I have following shared dependencies,
but not all of them are really wanted if only A or B is active:

[features]
# default = ["a"]
a = []
b = []

[dependencies]

# for A feature enabled only?
chrono = { version = "0.4.41", features = ["serde"] }
librqbit-core = "5.0.0"

# for B feature enabled only?
log = "0.4.28"
regex = "1.11.2"

How to skip B requirement if I'm using only A for this library?

3 posts - 2 participants

Read full topic

🏷️ Rust_feed