I know that when you add a crate to your Cargo.toml
file and run cargo build
, or when you vendor a crate to your local project folder, in both cases, the crate and it's dependency crates are first downloaded to the /path/to/home/.cargo/registry
folder.
(And that then, you can add those crates to other projects offline, either normally or by vendoring, from the saved copies in /path/to/home/.cargo/registry
).
First question : Is that is there a
cargo
command exclusively for adding a crate to the/path/to/home/.cargo/registry
directory?- Something like Python's
pip install package_name
command. - The idea here is to download crates to the
/path/to/home/.cargo/registry
directory first. And then add dependencies to my projects from that, in offline mode (cargo build --offline
andcargo vendor --offline
).
- Something like Python's
Second question : Is there a command to search whether a crate is already "installed" in this way, in the
/path/to/home/.cargo/registry
directory? (thecargo search
searches in crates.io).
Thanks.
PS: I first thought this was the cargo install
command but the manual says it works only on crates that have executable targets (as opposed to, presumably, purely library crates).