Originally published on php2rust.dev — part of the PHP to Rust course. View this lesson on the original site.

With Rust and Cargo installed, you can create a new project using cargo new. Open a terminal, go to the directory where you want the project, and run:

cargo new my_project

Replace my_project with your project name. Cargo creates a directory with:

  • Cargo.toml, project metadata and dependencies
  • src/, your source code
  • A basic main.rs to get you started

What's next

Next: Managing dependencies with Cargo.toml.

From PHP to Rust — Getting Started with Rust