I have a crate in which I want to have optional support for tokio, but when the tokio
feature is enabled, I want it to imply tokio-util
as well. I want to express something along the line of:
[features]
tokio = ["tokio", "tokio-util"]
[dependencies]
tokio-util = { version = "0.6", optional = true }
[dependencies.tokio]
version = "1"
features = ["net"]
optional = true
This doesn't work because:
Caused by:
optional dependency `tokio` is not included in any feature
Make sure that `dep:tokio` is included in one of features in the [features] table.
I can easily work around this by renaming tokio
under [features]
to something else. My questions are:
- Much like crates that support
serde
have aserde
feature, it really would be nice to have atokio
feature, though I understand if this can't be done. Is there a way to express the implied dependency ontokio-util
when the featuretokio
is used? - If the answer is "no" to the previous question, then I wonder if there's some de-facto standard convention to naming features which are used in this manner?