1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-02 16:55:24 +02:00
tldr/pages/common/cargo-build.md

33 lines
759 B
Markdown
Raw Normal View History

2020-09-08 13:19:03 -03:00
# cargo build
> Compile a local package and all of its dependencies.
> More information: <https://doc.rust-lang.org/cargo/commands/cargo-build.html>.
- Build the package or packages defined by the `Cargo.toml` manifest file in the local path:
`cargo {{[b|build]}}`
2020-09-08 13:19:03 -03:00
- Build artifacts in release mode, with optimizations:
`cargo {{[b|build]}} {{[-r|--release]}}`
2020-09-08 13:19:03 -03:00
- Require that `Cargo.lock` is up to date:
`cargo {{[b|build]}} --locked`
2020-09-08 13:19:03 -03:00
- Build all packages in the workspace:
`cargo {{[b|build]}} --workspace`
2020-09-08 13:19:03 -03:00
- Build a specific package:
`cargo {{[b|build]}} {{[-p|--package]}} {{package}}`
2020-09-08 13:19:03 -03:00
- Build only the specified binary:
`cargo {{[b|build]}} --bin {{name}}`
2020-09-08 13:19:03 -03:00
- Build only the specified test target:
`cargo {{[b|build]}} --test {{test_name}}`