Rust Cargo

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

Cargo is Rust's package manager, used to manage crates (Rust's term for libraries/packages). Cargo predominantly fetches packages from crates.io and can manage complex dependency trees with specific version requirements (using semantic versioning). Cargo can also help build, run and manage Rust projects with cargo build, cargo run and cargo test (among other useful commands).

Syntax

  • cargo new crate_name [--bin]
  • cargo init [--bin]
  • cargo build [--release]
  • cargo run [--release]
  • cargo check
  • cargo test
  • cargo bench
  • cargo update
  • cargo package
  • cargo publish
  • cargo [un]install binary_crate_name
  • cargo search crate_name
  • cargo version
  • cargo login api_key

Remarks

  • At the moment, the cargo bench subcommand requires the nightly version of the compiler to operate effectively.


Got any Rust Question?