-1

Due to our company cyber security policy, I have to work in offline mode. (From offline, here I mean, internet can never be connected to the PC, the only option is to download source on some other PC and copy it to the target PC, where I am developing rust projects)

On experimental basis, I wanted to develop and run the guessing_game ( https://doc.rust-lang.org/book/ch02-00-guessing-game-tutorial.html).

I downloaded and copies the source code of the guessing_game to offline PC. I also downloaded and copied source code of rand crate (https://github.com/rust-random/rand) to my offline PC.

What are the steps to configure my PC such that it start pointing to the offline source of rand crates instead of going to the internet (As it is not connected to internet).

1 Answers1

1

You could try using cargo-local-registry. It allows you to make a local registry, that is, a mirror of crates.io with only the packages you're interested in. Then, when you build, cargo can be told to only fetch packages from there (no online connection requested).

jthulhu
  • 7,223
  • 2
  • 16
  • 33
  • Thanks BlackBeans, but the million dollar question is how to install cargo-local-registry offline :-) – Syed Kamran Apr 18 '22 at 06:29
  • 1
    You may run the installation steps given in the documentation on an online computer, keep track of what it did, and copy the result on your offline computer. – jthulhu Apr 18 '22 at 06:34
  • You mean to say, I should check, which folder has been created etc? – Syed Kamran Apr 19 '22 at 17:54
  • 1
    @SyedKamran You could also simply read the documentation to see which files you are supposed to copy but meh, who reads the documentation? – jthulhu Apr 19 '22 at 20:11