I would like to take some code that is in one of my Rust apps and put it in a reusable library that can be used by other Rust projects. I have not yet found a good article focusing on how to do this. I suspect the individual pieces are there in documentation, but not collected into a coherent narrative.
I know that the code can be put into a module of the project, but I am pretty sure I want to put it into a module outside of the project. I have found a few articles talking about uploading to crates.io, but that seems deeply inappropriate for code that is either personal, super-niche, or proprietary.
The example that comes to mind is from the Java ecosystem with mvn install
which compiles your library and puts a copy in ~/.m2/repo/
where any of your other multiple source trees can find it and use it.
I expect this to work with multiple independent source trees, each of which would be its own git repository.
What is the Cargo equivalent of this? How should the Cargo.toml files look for the library and for each application that uses the library? What would the directory tree look like for the library and each application?