Rust - Hello, Cargo!
Cargo is Rust’s build system and package manager.
Cargo Installation
Installed with rust
Rust - Hello, World!
Cargo.toml & Cargo.lock
- Cargo.toml - defines various aspects of the project such as its name, version and dependencies.
- Cargo.lock - file generated by cargo contains information about the dependencies.
Create a project
$ cargo new <project-name>
Run a project
$ cargo run
Build a project
$ cargo build # <- debug mode
$ cargo build --release # <- release mode
- debug: build without optimizations, takes less time to build.
- release: build with optimizations, takes more time to build.
Add a dependency
$ cargo add <package-name>
Remove a dependency
$ cargo remove <package-name>