Is it possible / advisable to publish a crate on crates.io that exists at a subdirectory of a github repo? I have a big rust project with a bunch of path dependencies to crates in the same folder and I want to publish some of these dependencies into named crates, without losing the advantage of being able to update the main project at the same time as the dependencies.
Yes, that works just fine if you specify the dependencies with both a path and a version: rust-postgres/Cargo.toml at master · sfackler/rust-postgres · GitHub
So in that toml file I see that
postgres crate depends on
tokio-postgres by both a relative path and by a version number. Which version does it use then? What happens if the local copy of
tokio-postgres in the repo diverges from the version 0.7.1 of the
tokio-postgres crate on crates.io?
It will always use the path dependency when built locally, and IIRC will fail to compile if the version constraint is incompatible with the local dependency's declared version.