Back to course

Setting Up the Environment & Cargo

Rust for Systems & Web3 Security

Getting Started with Rustup

To install Rust, we use rustup. It manages versions and toolchains.

bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Meet Cargo: Your New Best Friend

Cargo is Rust's package manager, build tool, and test runner.

  • cargo new project_name: Creates a new project.
  • cargo build: Compiles your code.
  • cargo run: Compiles and runs in one step.
  • cargo check: Verifies code without building a binary (much faster).

The Anatomy of a Cargo Project

  • Cargo.toml: The configuration file (manifest) where you define dependencies.
  • src/main.rs: The entry point of your application.