Cargo install and duplicates?


Just beginning with Rust.
Used to static and shared libraries I wonder if it is possible to have crates downloaded in a single place for multiple projects to use that, instead of downloading the same crates again and again in different projects I may have on a system.


The source for dependencies will be downloaded to the ~/.cargo/registry/src/* directory, so the sources are shared.

As for compiled artifacts, you can deduplicate them using sccache.

It's also possible to specify an alternate location for the target directory. By using the same directory for multiple projects, they will share compiled artifacts.

That was quick :grinning:

Ok so I can keep going!

Thanks alice

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.