Elegant way to express dependent of either features

I am modifying a crate with several features.

2 of them are "native-tls" and "rustls", I want to express something like the third feature is depending either of them.

Are there elegant ways? I know two methods now.

  1. Create a sub crate for it.
  2. Use compile errors to indicate users.

But the crate is currently running on "cargo hack" requiring every feature combination is OK.

1 Like

If you already have two alternatives, then answers would be speculative and informed by preference. Perhaps you select a method and then ask specific questions based on that?

I finally chose the second option. And I make cargo hack suitable for my use case. Refactor feature_powerset function to handle mutually exclusive features correctly by sunmy2019 · Pull Request #235 · taiki-e/cargo-hack · GitHub

Thank you anyway! :slightly_smiling_face: