Cargo is the Package Manager as well as the Built Tool for the Rust Programming Language.
So, you will need to make use of cargo commands on a day-to-day basis if you work with Rust.
Sr. No. | Command | Description |
---|---|---|
1 | cargo new <project-name> | To create a new Cargo package with the specified name. |
2 | cargo b | Alias for cargo build . |
3 | cargo run | To build and run the current package. |
4 | cargo test | To run the tests for the current package. |
5 | cargo d | Alias for cargo doc . |
6 | cargo update | To update the dependencies of the current package. |
7 | cargo clean | To remove artifacts that Cargo has generated in the past. |
8 | cargo publish | To publish the current package to the crates.io registry. |
9 | cargo install <crate> | To install the specified crate from crates.io. |
10 | cargo uninstall <crate> | To uninstall the specified crate. |
11 | cargo check | To check a local package and all of its dependencies for errors. |
12 | cargo fmt | To format the source code in the current package according to the project's style guidelines. |
13 | cargo bench | To run the benchmarks defined in the current package. |
14 | cargo build --release | To build the current package with optimizations for release. |
15 | cargo run -- <args> | To run the current package with the specified command-line arguments. |
16 | cargo build --target <target> | To build the current package for the specified target. |
17 | cargo doc --open | To generate documentation and open it in the default browser. |
18 | cargo login | To log in to the crates.io registry. |
19 | cargo logout | To log out from the crates.io registry. |
20 | cargo search <crate> | To search for crates with the specified name on crates.io. |
21 | cargo metadata | To display the metadata about the current package and its dependencies. |
22 | cargo --version | To print the version of Cargo. |
23 | cargo --help | To display help information about Cargo and its commands. |
24 | cargo add | To add dependencies to a Cargo.toml manifest file. |
25 | cargo fix | To automatically fix lint warnings reported by rustc. |
26 | cargo generate-lockfile | To generate the lockfile for a package. |
27 | cargo init | To create a new cargo package in an existing directory. |
28 | cargo locate-project | To print a JSON representation of a Cargo.toml file's location. |
29 | cargo package | To assemble the local package into a distributable tarball. |
30 | cargo publish | To upload a package to the registry. |
31 | cargo read-manifest | To print a JSON representation of a Cargo.toml manifest. |
32 | cargo remove | To remove dependencies from a Cargo.toml manifest file. |
33 | cargo rm | Alias for cargo remove . |
34 | cargo rustc | To compile a package, and pass extra options to the compiler. |
35 | cargo rustdoc | To build a package's documentation, using specified custom flags. |
36 | cargo search | To search packages in crates.io. |
37 | cargo t | Alias for cargo test . |
38 | cargo tree | To display a tree visualization of a dependency graph. |
39 | cargo uninstall | To remove a Rust binary. |
40 | cargo update | To update dependencies as recorded in the local lock file. |
41 | cargo verify-project | To check the correctness of a crate manifest. |
42 | cargo version | To show version information. |
43 | cargo yank | To remove a pushed crate from the index. |
-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to Rust,
- Rust: Cargo Init vs Cargo New Command
- Rust: Write and Run Hello World! Program Example
- How to Split a String using Rust Language
- How to Sort a Vector in Rust with Examples
- Fix: error: could not find `Cargo.toml` in Users or any parent directory
- How to uninstall Rust Language from Mac/Linux/Ubuntu
- How to update Cargo (Rust Lang)
- Fix: rust-analyzer failed to discover workspace [Visual Studio Code]
- How to install Rust using rustup on macOS/Linux/Ubuntu
- Cargo Watch: To Recompile Rust Project Automatically
- Difference between rustc and cargo build commands
- How to Split a String by Space in Rust
- How to know Rust is Installed on Mac?
- Rust: zsh: no such file or directory: ./main
- How to update Rust on Mac/Linux
- List of Rust Cargo Commands
- How to find version of Cargo in Rust
- Fix: error: mismatched closing delimiter } [Rust]
More Posts:
- Fix SharePoint Error - The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started - SharePoint
- Outlook and Hotmail not working - email issue, message not delivered, send receive problem - Microsoft
- Set width and height for the label in tkinter - Python
- How to install zsh shell on Ubuntu - Ubuntu
- AlertDialog with image using ImageView Example - Android
- Bash - How to check if a Command Failed? - Bash
- Android Studio: Cannot perform refactoring operation - Android-Studio
- MainActivity error: cannot find symbol FloatingActionButton - Android