【笔记】Cargo学习笔记

Preface

Rust Package Manager (Cargo) Study Notes

Check version

1
cargo --version

List all commands

1
cargo --list

View help

1
cargo --help

View help for a specific subcommand

<sub_command>: Subcommand

1
cargo <sub_command> --help

Create a Rust project maintained by Cargo

<project_name>: Project name

1
cargo new <project_name>

Check the project

  • Check for errors in the project without compiling the source code
1
cargo check

Compile the current project

1
cargo build

Compile and execute the current project

1
cargo run

Clean the project

  • Delete all directories and files in the target directory
1
cargo clean

Update all dependencies of the project

  • Update all dependencies listed in the Cargo.lock file in the project directory
1
cargo update

Completion

References

Bilibili - Focused Learning for Salary Increase