I have tried this command "cargo build --offline" and got the following messages
**
Compiling getrandom v0.2.2
Compiling cfg-if v1.0.0
Compiling ppv-lite86 v0.2.10
Compiling rand_core v0.6.2
Compiling rand_chacha v0.3.0
Compiling rand v0.8.3
Compiling KA_Test_rustIProject3 v0.1.0 (F:\KA_IdeaProjects\KA_Test_rustIProject3)
warning: crate KA_Test_rustIProject3 should have a snake case name
|
= note: #[warn(non_snake_case)] on by default
= help: convert the identifier to snake case: ka_test_rust_iproject3
warning: 1 warning emitted
Finished dev [unoptimized + debuginfo] target(s) in 23.59s
** It compiled correctly. Finally entered this command "cargo run"
strong text
**
Compiling KA_Test_rustIProject3 v0.1.0 (F:\KA_IdeaProjects\KA_Test_rustIProject3)
warning: crate KA_Test_rustIProject3 should have a snake case name
|
= note: #[warn(non_snake_case)] on by default
= help: convert the identifier to snake case: ka_test_rust_iproject3
warning: 1 warning emitted
Finished dev [unoptimized + debuginfo] target(s) in 2.26s
Running `target\debug\KA_Test_rustIProject3.exe`
Hello, world!
The random number is: 69
**
The program worked correctly. Thanks for guidance. When do we use this command "cargo install --offline"??
They're cached in ~/.cargo/registry/cache folder. It's not being downloaded more than once.
Cargo will compile each dependency separately for each project. Currently there's no good solution to this, existing half-solutions (like changes of target dir) are not good.
If it's a very big issue for you, you can try installing sccache, but IMHO it's not worth it unless you have hundreds of projects with thousands of dependencies.