I want to take over the no longer maintained open source Rust package that is already deployed in crates.io.
While it is obviously in place and appropriate to require a different name for my fork in Cargo.toml, I would prefer not to require changes in the rest of the code, to make switching easier for potential users. When I simply renamed the entry in Cargo.toml, lots of code got broken everywhere. Exactly the old name is required.
It looks more logical to provide pluggable implementations of the same functionality the user can easily switch between, comparing performance and results of the own tests.
As a workaround, I am currently specifying the git URL in Cargo.toml:
old_name = { git = "https://github.com/new_repository", branch = "1.0.0" }
This works for me when testing my own deployment. But I probably should prefer crates.io for a public open-source project.
Is it possible to deploy a project on crates.io under a different name than the package name as referenced in the code, and how? I checked the documentation of cargo publish, but it does not seem to cover this case.
1
You can rename a dependency by specifying the package
(documentation). Here’s how that’d look:
old_name = { package = "new_name", version = "..." }
This means that it will be accessible as old_name
in your code, but cargo will look for it as new_name
when resolving.