Reputation: 486
I am using a library that breaks depending on which other crates I am using. The way around is to downgrade a few dependencies and keep a local version of the library.
It works if I put MyLibraryDep = {version = "*"}
in my Cargo.toml
. Since Cargo will then fix dependencies automatically, but crates.io doesn't allow for that.
Example:
If using MyLibrary
, and LibraryA
I have to use MyLibraryDep v0.1.0
in MyLibrary
If using MyLibrary
, and LibraryB
I have to use MyLibraryDep v0.2.0
in MyLibrary
Upvotes: 2
Views: 520
Reputation: 71969
As specified in the Cargo book, you can use inequality requirements and multiple requirements combined to form a range of valid versions.
MyLibraryDep = {version = ">=0.1.0, <=0.2.0"}
Such a requirement will also allow Cargo to choose the appropriate version and should be allowed by crates.io.
Upvotes: 5