Automatic Version Selection?

Continuing the discussion from PSA: Check if your Cargo crates are clean and tagged:

Thank you!

I have a question (for the forum at large; it's not directed at you). This is from one of my crates...

Dependency windows 0.48 is outdated
Upgrade to 0.54.0 to get all the fixes

Unfortunately, from 48 to 54 is a breaking change. I had to make a decision to support one of them. I decided the older one was the better choice based on the assumption that there were probably more folks using it. (It looks like 51 is now the better choice.)

Do I have to pick one? Is there a way to have conditional compilation based on what was chosen for the dependent crate? For example, if Cathy Jo is using version 54, is there a way my crate can automatically use 54? Where conditional compilation adjusts my crate for someone using 54?

You can define a feature for each of the two incompatible versions, but I don’t believe there’s a way to switch between them automatically— Your dependents will need to explicitly turn on the feature they need (or turn off a default feature they don’t).

2 Likes

Yeah. That's what I thought. Bummer.

Thank you for the reply!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.