Sharing crate dependancies

I am a new learner. I had learnt the guessing game from the book. I tried to create another version of the game but it requires downloading the crate for rand again. How can I prevent this and use one central crate project with others just using what is required? Like the venv in Python, I have stored numpy and django there and for any file requiring django, I just set environment to the central folder. Is it possibe in Rust?

They are downloaded only once (until you clear the ~/.cargo directory, of course), but they will be compiled for each project independently. One of the reasons is that format of the compiled artifacts (rlib format) is not stable, so you can't precompile the crate and use it with any other version of the compiler.


And you can use sccache to cache build artifacts globally, instead of the per-module basis. It also supports various cloud storage for cache so two or more machines can share their build cache

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.