Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Hello, Cargo! · Lesson 4 of 8

Setting Up a Project with Cargo

A free lesson from Swipe Coding · Rust, level 2 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
One command, and Rust hands you a ready-to-run project — no folder-wrangling required. 📦

Cargo is Rust's built-in build tool and package manager — think of it as npm and a build system rolled into one, and it comes installed automatically alongside the Rust compiler. Running cargo new my_project creates a brand-new folder called my_project, already set up with everything a Rust project needs to compile and run.

cargo new my_project
cd my_project
Creating a new Rust project called my_project, then moving into its folder.

That command creates two important things: a Cargo.toml file at the top level, and a src folder containing main.rs. Cargo.toml is the project's manifest — it lists the package's name, version, the Rust edition it targets, and any external dependencies it needs. src/main.rs is where your actual program code lives, and Cargo starts it off with a working 'Hello, world!' program already written for you.

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
A freshly generated Cargo.toml — the project's manifest, with no dependencies added yet.
Fill in the blank

Cargo's project manifest, listing a package's name, version, and dependencies, is called ____.

Quick check

What does running cargo new my_project create?

Keep your streak going in Swipe Coding

Swipe through every level of Rust on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →