0

I would like to use the tango client crate for a Rust project at work, however the environment that I will be developing this in does not have direct access to the internet. This means that the standard method of adding the dependency to Cargo.toml and running cargo build fails due to a network error.

The environment doesn't prevent me from copying data downloaded to an internet-connected computer, and so I was hoping that there would be a way for me to package the necessary files locally, and then point Cargo.toml to that location.

Is this possible? If so, how?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
smolloy
  • 308
  • 1
  • 11

1 Answers1

1

Answering my own question, thanks to a tip in a comment from @Dogbert.

The trick was to use cargo vendor on the machine that has an internet connection. This will produce a directory called vendor that can be transferred to the other environment. On that environment, and within the directory from which you will run cargo build, create a new file in .cargo/config.

[source]
[source.local_vendor]
directory = "vendor"

[source.crates-io]
replace-with = "local_vendor"

Once you've done this, then cargo build should work.

smolloy
  • 308
  • 1
  • 11