Linux command
cargo-fetch 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Fetch all dependencies
cargo fetch
Fetch for specific target
cargo fetch --target [x86_64-unknown-linux-gnu]
Fetch with locked versions
cargo fetch --locked
Fetch offline (from cache)
cargo fetch --offline
说明
cargo fetch downloads all dependencies from the network and stores them locally. If Cargo.lock exists, fetches exact versions specified. Otherwise, generates the lock file first. Useful for preparing to work offline with the --offline flag.
参数
- --target _triple_
- Fetch for specified target architecture (can be repeated)
- --locked
- Assert same dependencies as original Cargo.lock
- --offline
- Use only locally cached crates
- --frozen
- Equivalent to --locked and --offline
- --manifest-path _path_
- Path to Cargo.toml
- -v, --verbose
- Verbose output
- -q, --quiet
- Suppress log messages
FAQ
What is the cargo-fetch command used for?
cargo fetch downloads all dependencies from the network and stores them locally. If Cargo.lock exists, fetches exact versions specified. Otherwise, generates the lock file first. Useful for preparing to work offline with the --offline flag.
How do I run a basic cargo-fetch example?
Run `cargo fetch` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --target _triple_ do in cargo-fetch?
Fetch for specified target architecture (can be repeated)