In the Path Dependencies section of the documentation, it states:
And that's it! The next cargo build will automatically build
hello_utilsand all of its own dependencies, and others can also start using the crate as well.
However, as far as I can tell, I do not understand how one would use this hello_utils sub-crate via git. The guide contains documentation on how to use a crate via git in the Adding Dependencies section of the documentation, but there doesn't seem to be any information on how to use a _sub_-crate from an entirely different project--only a "top-level" crate.
For instance, if I submitted a PR to the hypothetical hello_world's hello_utils sub-crate and wanted to use it immediately in my own project, how would I do that?
Perhaps this is obvious but after searching online and trying a number of things on my own, I can't seem to find a solution for this.
Cargo searches a repo for crates, it doesn't just look for a Cargo.toml at the top level, so say
[dependencies.hello_utils]
git = "https://github.com/huonw/hello_world"
would work if I had a hello_world repo with a crate called hello_utils somewhere in it.
I think this has been covered and can be closed.
Indeed!
it doesn't just look for a Cargo.toml at the top level
This tripped me up and would be super helpful to see in the docs. This works (but was surprising):
[dependencies]
rocket = { git = "https://github.com/SergioBenitez/Rocket/" }
rocket_codegen = { git = "https://github.com/SergioBenitez/Rocket/" }
Most helpful comment
This tripped me up and would be super helpful to see in the docs. This works (but was surprising):