Hi everyone,
I am new to Rust programming and I cannot figure out how to use crates in offline environment. For some security reasons, I have no connection to internet. What I would like to do is, download crates from GitHub and want to give it as a path dependency to my Cargo.toml file. I thought, this is working because I have tried it for "libc" crate. I download the libc crate from github (GitHub - rust-lang/libc: Raw bindings to platform APIs for Rust). Then, give the path to Cargo.toml file under dependency title. And it worked.
[dependencies]
libc = {path = "/home/CRATES/libc"}
However, when I tried to use "quick-xml" and "serde" crates, this approach seems useless. In my opinion, the problem was each crate has different dependencies. I have download every crate that dependent both to quick-xml and serde crates and put them into CRATES folder. Then give the path in Cargo.toml file but it was still trying to connect the crates.io.
[dependencies]
quick-xml = {path = "/home/CRATES/quick-xml"}
serde = {path = "/home/CRATES/serde/serde"}
Then I add .cargo/config.toml to my root folder ($CARGO_MANIFEST_DIR of my project) and change the source as follows.
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "home/CRATES"
And cargo gives error of no such file or directory about a file inside a crate folder .cargo-checksum.json. I cant give the name which crate folder it is because every time I play with Cargo.toml file it changes. In addition, I cannot also use cargo vendor since It is also trying to connect internet .
So simplify my question; Is there any way to use the crates by downloading them from GitHub and use them by editing Cargo.toml file of my project. If it possible can you guys show me how to? If it is not possible, can you suggest any other way to use crates without connecting internet at all. Any help would welcome. I appreciate for your time.