- 01Setting up (what you'll need)
- 02Your first output (println!)
- 03Variables and mutability (let / mut)
- 04Type annotations and basic types
- 05Branching (the if statement)
- 06Repeating (the for loop)
- 07Writing your own function
- 08Repeating (while and loop)
- 09Ownership, the basics
- 10Borrowing (references, &)
- 11Working with vectors (Vec)
- 12Structs
- 13enum and the match expression
- 14The Option type (null safety)
- 15The Result type and error handling
- 16Traits
- 17Generics
- 18Closures
- 19Working with strings (String)
- 20[Project] Build a small inventory system
[Project] Build a small inventory system
In this lesson you combine the structs, enums, vectors, and match expressions covered so far into a simple inventory system. It is the capstone of this Rust introduction.
Real business systems use this combination constantly: represent something like a product with a struct, manage many of them in a vector, and branch on state with an enum and match.
The sample code represents a product (name and quantity) with struct Item, tracks stock level with enum Status, and prints a per-state message with match.
Ownership, borrowing, Option, and Result — everything covered in these lessons — are the foundations you will design around in real systems and tools. Getting into the habit of writing small programs while thinking about ownership is the shortest path to using Rust professionally.
๐งช This site can't compile or run Rust directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ nothing is sent anywhere).
