← 返回命令列表

Linux command

cargo-generate-lockfile 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Generate lock file

cargo generate-lockfile

Regenerate with latest versions

cargo generate-lockfile

Generate with specific manifest

cargo generate-lockfile --manifest-path [path/to/Cargo.toml]

Generate with custom lockfile path

cargo generate-lockfile --lockfile-path [/tmp/Cargo.lock]

说明

cargo generate-lockfile creates or rebuilds Cargo.lock for the current package or workspace. If lockfile exists, rebuilds with latest available versions of all packages.

参数

--manifest-path _path_
Path to Cargo.toml
--lockfile-path _path_
Custom lockfile path (must end with Cargo.lock)
--locked
Assert exact same dependencies as original lockfile
--offline
Don't access network
--frozen
Equivalent to --locked and --offline
-v, --verbose
Verbose output (use twice for very verbose)
-q, --quiet
Suppress log messages

FAQ

What is the cargo-generate-lockfile command used for?

cargo generate-lockfile creates or rebuilds Cargo.lock for the current package or workspace. If lockfile exists, rebuilds with latest available versions of all packages.

How do I run a basic cargo-generate-lockfile example?

Run `cargo generate-lockfile` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --manifest-path _path_ do in cargo-generate-lockfile?

Path to Cargo.toml