“Certified Rust Programming Expert” – A complete path from beginner to professional
Hello, future Rust expert! Have you ever wondered how computers run games, send messages, and keep your money safe in banks? The answer is systems programming. And the best language for systems programming today is Rust.
Rust is a language used by big companies like Microsoft, Google, Amazon, and even space agencies. It is fast, safe, and helps you build programs that do not crash easily. But do not worry—Rust is also fun and friendly for beginners. This module will start from the very beginning.
In this first module, we will learn what Rust is, why it is special, how to install it, and how to write your very first programs. We will use simple words, fun stories, and lots of examples from Nigeria and around the world. By the end, you will understand the heart of Rust and be ready to continue your journey to becoming a Certified Rust Programming Expert.
No prior coding experience is needed. Just bring your curiosity and a willingness to learn!
After finishing this module, you will be able to:
Once upon a time in Lagos, Nigeria, there lived a clever girl named Ada. Ada loved building things. One day, she built a small robot named Chidi. Chidi could walk, talk, and even fetch water. But there was a big problem: Chidi kept crashing into walls! Every time Ada gave Chidi a command, Chidi would get confused and fall down.
Ada asked her friend, Tunde, who was a computer whiz. Tunde said, “Ada, the problem is not Chidi’s body. It is Chidi’s brain. The instructions inside Chidi are not safe. The computer language you used lets Chidi make mistakes that the computer cannot catch. You need a language that checks your work before the robot moves.”
Ada was curious. “Which language can do that?” she asked. Tunde smiled and said, “Rust! Rust is like a careful teacher. It checks every instruction before the robot runs. It stops mistakes that could make Chidi crash. With Rust, Chidi can walk safely and never bump into walls again.”
Ada decided to learn Rust. She read books, watched videos, and practised every day. Slowly, Chidi became the smartest robot in Lagos. Chidi could walk, stop, turn, and even greet people without falling. Ada was so proud!
Today, Ada is a Certified Rust Programming Expert. She builds robots, apps, and systems for companies all over the world. And it all started with one decision: to learn Rust.
Moral of the story: Rust helps you write code that is safe and correct, so your programs (or robots!) do not break easily. With practice, you can become an expert too.
Definition: Systems programming is writing software that controls the computer’s hardware and makes other programs run. It is like being the engineer who builds the roads and bridges that other cars (apps) drive on.
Why it is important: Without systems programming, your computer would not know how to turn on, save files, or connect to the internet.
Simple explanation: Imagine your computer is a big city. Systems programs are the roads, traffic lights, and water pipes. They keep everything moving. Apps like games and browsers are the cars and houses that use those roads.
Real-life example: The operating system (like Windows, macOS, or Linux) is a systems program. It manages your keyboard, screen, and memory.
School example: The school timetable is like a systems program. It tells each class when to go to which room. Without it, chaos!
Home example: Your home’s electrical wiring is a system. It delivers power to your TV, fridge, and lights safely.
Nigerian example: The traffic lights in Abuja are systems. They control when cars move and stop. If they fail, there is a big hold-up. Systems programming keeps such systems working.
Illustration:
+-------------------+ +-------------------+
| HARDWARE | | SYSTEMS |
| (CPU, memory, |<----->| PROGRAM |
| disk, screen) | | (Operating System)|
+-------------------+ +-------------------+
^ ^
| |
| |
+-------------------+ +-------------------+
| APPLICATIONS | | RUST CODE |
| (Games, browsers) | | (You write this!) |
+-------------------+ +-------------------+
Mini summary: Systems programming builds the foundation that all other software uses. Rust is a language made for this job.
Definition: Rust is a programming language that focuses on speed, safety, and doing many things at once (concurrency).
Why it is important: Many programs crash because of memory errors. Rust stops those errors before the program even runs.
Simple explanation: Think of Rust as a strict but caring coach. It checks your code and says, “Wait, this part might cause a problem. Let’s fix it now.” Other languages might let you run and then crash later.
Real-life example: A bank uses Rust to handle millions of transactions. If the program crashes, people lose money. Rust prevents crashes.
School example: A teacher who marks your homework before you submit it is like Rust. A teacher who only marks after you fail is like some other languages.
Home example: Before you cook, your mum checks if the gas is off. Rust checks your code before it runs.
Nigerian example: In a busy market like Balogun in Lagos, a good trader counts money carefully before giving change. Rust counts and checks memory carefully to avoid “change” errors.
Illustration:
Other languages: Rust:
Write code Write code
| |
V V
Run program Compiler checks
| |
V V
Maybe crash! If safe, run
Else, fix first
Mini summary: Rust is safe, fast, and prevents many common bugs. That is why big companies love it.
Definition: Installing Rust means putting the Rust tools on your computer so you can write and run Rust programs.
Why it is important: You cannot build a house without tools. Rust has its own tools: rustc (the compiler) and cargo (the project manager).
Simple explanation: rustc turns your human-readable code into computer instructions. cargo helps you create projects, add libraries, and run tests.
Real-life example: A carpenter uses a hammer and saw. A Rust programmer uses rustc and cargo.
School example: Your school bag holds your books and pens. Cargo is like your school bag for Rust projects.
Home example: A toolbox in your house has a screwdriver and pliers. The Rust installation gives you a toolbox for coding.
Nigerian example: A tailor in Kano uses a sewing machine and scissors. A Rust programmer uses rustc and cargo to “stitch” code together.
Illustration:
Your Computer
|
V
Install Rust (from rustup.rs)
|
+--> rustc (compiler)
|
+--> cargo (project manager)
|
V
Ready to write Rust!
Step-by-step installation:
rustup.rs in your browser.rustc --version to check it works.cargo --version to check Cargo.Mini summary: Install Rust using rustup. Then you get rustc and cargo to build programs.
Definition: A “Hello, World!” program is the simplest program that prints a message to the screen.
Why it is important: It confirms that your tools work and you can run Rust code.
Simple explanation: You write a few lines. The computer reads them and shows “Hello, World!” on your screen.
Real-life example: When you say “Hello” to a friend, they say “Hello” back. Here, you tell the computer to say “Hello, World!”.
School example: The first day of school, you introduce yourself. This is your program’s introduction.
Home example: When you knock on a door, someone answers. This program knocks on the computer’s door.
Nigerian example: In Nigeria, we greet with “How are you?” The computer greets with “Hello, World!”.
Illustration:
fn main() {
println!("Hello, World!");
}
Step-by-step:
cargo new hello_rust.cd hello_rust.src/main.rs in a text editor.cargo run.Hello, World! on the screen.Explanation:
fn main() { ... } – This is the starting point. Every Rust program begins here.println!("Hello, World!"); – This prints the text inside the quotes.; tells Rust that the instruction is finished.Mini summary: “Hello, World!” is your first step. It shows you how to write and run a basic Rust program.
Definition: A variable is a named box that stores a value. You can change what is inside (unless it is immutable).
Why it is important: Programs need to remember numbers, words, and other data. Variables hold that data.
Simple explanation: Imagine a kitchen cupboard. You put rice in one container, beans in another. You label them “rice” and “beans”. In Rust, you write let rice = 5;.
Real-life example: Your school bag has pockets for books, pens, and lunch. Each pocket is a variable.
School example: A register has columns for names, ages, and scores. Each column is like a variable.
Home example: Your phone’s contact list stores names and numbers. Each contact is a variable.
Nigerian example: A trader in Onitsha market has baskets for tomatoes, peppers, and onions. Each basket is a variable.
Illustration:
let age = 13; let name = "Ada"; let is_hungry = true;
Step-by-step:
let followed by the variable name.= to assign a value.;.Mini summary: Variables store data. Use let to create them. You can change them later if you use mut.
Definition: A data type tells Rust what kind of value a variable holds: a number, a word, a true/false, etc.
Why it is important: Rust needs to know if you are adding numbers or joining words. Different types have different rules.
Simple explanation: You don’t put water in a paper bag. You use a bottle. Similarly, you use i32 for whole numbers, f64 for decimals, bool for true/false, and String for text.
Real-life example: A fuel gauge shows numbers. A name tag shows words. A light switch shows on/off (bool).
School example: Your report card has numbers for scores, letters for grades, and yes/no for attendance.
Home example: A TV remote has buttons for numbers (channels), on/off (bool), and volume (numbers).
Nigerian example: A market woman sells yams (counted in numbers), peppers (measured in cups), and “sold out” (true/false).
Table of common types:
| Type | What it stores | Example |
|---|---|---|
| i32 | Whole number (integer) | 42, -7, 0 |
| f64 | Decimal number | 3.14, 2.5 |
| bool | True or false | true, false |
| String | Text | "Hello", "Lagos" |
| char | Single character | 'A', '7' |
Illustration:
let age: i32 = 13;
let price: f64 = 500.50;
let is_open: bool = true;
let name: String = String::from("Ada");
let grade: char = 'A';
Mini summary: Data types keep your data organised. Rust checks that you use the right type.
Definition: Mutability means you can change the value of a variable. In Rust, variables are immutable (cannot change) by default. You must add mut to make them mutable.
Why it is important: Immutability prevents accidental changes. It makes programs safer and easier to understand.
Simple explanation: Imagine a pencil writing on paper. You can erase and rewrite (mutable). But a pen writes permanently (immutable). Rust starts with pen by default; you choose pencil with mut.
Real-life example: Your birthday date never changes (immutable). Your age changes every year (mutable).
School example: Your name is fixed (immutable). Your class teacher can change (mutable).
Home example: The number of chairs in your house can change when guests come (mutable). The address of your house is fixed (immutable).
Nigerian example: The price of fuel can change (mutable). The location of your house is fixed (immutable).
Illustration:
let x = 5; // immutable, cannot change // x = 10; // ERROR! let mut y = 5; // mutable y = 10; // OK!
Mini summary: Use let for unchangeable variables. Use let mut for changeable ones. Rust loves safety.
Definition: A function is a named block of code that does a specific job. You can call it many times.
Why it is important: Functions avoid repeating code. They make programs shorter and easier to fix.
Simple explanation: Think of a function as a recipe. You write it once, then use it whenever you want to cook that dish.
Real-life example: A tailor has a pattern for a shirt. He uses the same pattern for many customers (function calls).
School example: The school bell rings at the same time every day. It is like a function called “ringBell()”.
Home example: Your blender has a “smoothie” button. You press it, and it does the same steps each time.
Nigerian example: A taxi driver has a route from Ikeja to Yaba. He repeats the same route (function) for many passengers.
Illustration:
fn greet() {
println!("Hello, friend!");
}
fn main() {
greet(); // calls the function
greet(); // calls it again
}
Step-by-step:
fn followed by the function name.().{ }.().Mini summary: Functions are named blocks. Use fn to define them and () to call them.
Definition: Comments are lines in your code that the computer ignores. They are for you and other humans to read.
Why it is important: Comments explain why you did something. They help you remember later and help others understand.
Simple explanation: Imagine writing notes in the margin of your school book. The teacher doesn’t mark them, but they help you study.
Real-life example: A recipe has notes like “bake for 20 minutes”. The oven ignores the note, but the cook reads it.
School example: Your class timetable might have small notes like “bring calculator”. They are comments for students.
Home example: A sticky note on the fridge says “buy milk”. It is a comment for the family.
Nigerian example: A signboard in traffic says “no parking”. It is a comment for drivers, not for the road.
Illustration:
// This is a single-line comment
let x = 5; // This comment explains the variable
/*
This is a multi-line comment.
It can span many lines.
*/
Mini summary: Use // for short comments and /* ... */ for longer ones. They make code friendly.
Definition: Printing means showing text on the screen. Input means the computer reads what you type.
Why it is important: Programs need to communicate with people. Printing shows results. Input lets users give data.
Simple explanation: Printing is like speaking. Input is like listening. A good program does both.
Real-life example: An ATM prints your balance. It also takes your PIN as input.
School example: A teacher asks a question (input) and writes the answer on the board (print).
Home example: A TV remote takes input (button press) and prints the channel on screen.
Nigerian example: A POS machine takes your card details (input) and prints a receipt (output).
Illustration:
use std::io;
fn main() {
println!("What is your name?");
let mut name = String::new();
io::stdin().read_line(&mut name).expect("Failed");
println!("Hello, {}!", name.trim());
}
Step-by-step:
println! to print text.std::io for input.String to hold input.io::stdin().read_line() to read.trim() to remove extra spaces.Mini summary: Use println! to print. Use stdin().read_line to read input. Always trim extra spaces.
Definition: The compiler is a program that turns your Rust code into a program the computer can run. It also checks for mistakes.
Why it is important: The compiler catches many errors before you run the program. This saves time and prevents crashes.
Simple explanation: The compiler is like a teacher who checks your homework before you submit it. If there is a mistake, the teacher tells you to fix it.
Real-life example: A building inspector checks a house before people move in. The Rust compiler checks your code before it runs.
School example: Before a debate, your teacher checks your speech for errors. That is the compiler.
Home example: Before cooking, your mum checks if all ingredients are available. That is the compiler.
Nigerian example: Before a bus leaves the park, the conductor checks that all passengers have paid. The compiler checks your code.
Illustration:
Your code (hello.rs)
|
V
rustc hello.rs <-- compiler
|
V
If no errors: hello executable
If errors: messages to fix
Mini summary: The Rust compiler is strict but helpful. It catches mistakes early. Always fix compiler errors.
Definition: Cargo is Rust’s tool for creating projects, building code, running tests, and adding libraries.
Why it is important: Without Cargo, managing big projects is hard. Cargo makes everything organised.
Simple explanation: Cargo is like a project folder with extra powers. It creates a structure, downloads dependencies, and runs your program.
Real-life example: A wedding planner organises the venue, food, and music. Cargo organises your Rust project.
School example: A class monitor collects homework and keeps things in order. Cargo is the monitor for your code.
Home example: A toolbox keeps all tools in one place. Cargo is your coding toolbox.
Nigerian example: An event planner for a Nigerian wedding handles aso-ebi, food, and canopies. Cargo handles your project’s files and libraries.
Illustration:
cargo new my_project
|
V
my_project/
├── Cargo.toml
└── src/
└── main.rs
Common Cargo commands:
| Command | What it does |
|---|---|
cargo new name | Creates a new project |
cargo build | Builds the project |
cargo run | Builds and runs the project |
cargo check | Checks for errors without building |
cargo test | Runs tests |
Mini summary: Use cargo new to start a project. Use cargo run to run it. Cargo keeps everything tidy.
Definition: Mistakes (bugs) are errors in code. Rust catches many before running.
Why it is important: Knowing common mistakes helps you avoid them.
Simple explanation: Rust is like a spell-checker. It underlines errors and suggests fixes.
Real-life example: Typing a wrong phone number. Rust checks if the number is valid.
School example: Forgetting to carry your pencil. Rust checks if you have all variables.
Home example: Forgetting to turn off the tap. Rust checks if memory is freed.
Nigerian example: Forgetting your change in a taxi. Rust checks that you don’t lose data.
Table of common mistakes:
| Mistake | What happens | Rust’s help |
|---|---|---|
Using a variable without mut | Cannot change value | Compiler error |
| Forgetting semicolon | Unexpected code | Compiler error |
| Wrong data type | Type mismatch | Compiler error |
| Reading input without trim | Extra newline | You must trim |
| Typo in variable name | Cannot find value | Compiler error |
Mini summary: Rust catches many mistakes early. Read compiler messages and fix them.
Definition: Best practices are good habits that make your code clean and safe.
Why it is important: Good habits make coding easier and more fun.
Simple explanation: Like brushing your teeth daily, coding habits keep your programs healthy.
Real-life example: Keeping your room tidy. Best practices keep code tidy.
School example: Writing neatly in your notebook. Best practices make code readable.
Home example: Washing plates after eating. Best practices prevent problems later.
Nigerian example: Keeping your market stall organised. Best practices keep code organised.
List of best practices:
score not s).cargo to manage projects.Mini summary: Good habits make you a better programmer. Start them now.
Let’s write a program that uses variables, functions, input, and printing.
Program: Greeting Card
use std::io;
fn greet(name: &str) {
println!("Hello, {}! Welcome to Rust.", name);
}
fn main() {
println!("What is your name?");
let mut name = String::new();
io::stdin().read_line(&mut name).expect("Failed to read");
let name = name.trim();
greet(name);
println!("You are on your way to becoming a Rust Expert!");
}
Explanation:
greet is a function that takes a name and prints a greeting.main asks for input, reads it, trims it, and calls greet.trim() removes the extra newline from input.&str is a string slice, a borrowed string.Mini summary: This program combines everything you learned in Module One. You can build it and run it!
| Word | Simple Definition |
|---|---|
| Systems programming | Writing software that controls hardware and supports other programs. |
| Rust | A safe, fast programming language for systems. |
| Compiler | A program that turns your code into a runnable program and checks for errors. |
| Cargo | Rust’s tool for managing projects. |
| Variable | A named box that stores a value. |
| Data type | The kind of value a variable holds (number, text, true/false). |
| Immutable | Cannot be changed. |
| Mutable | Can be changed. |
| Function | A reusable block of code that does a job. |
| Comment | A note in code that the computer ignores. |
| Show text on the screen. | |
| Input | Data typed by the user. |
| Bug | A mistake in code. |
| Concurrency | Doing many things at the same time. |
mut.rustup.rs.cargo new hello_rust to create a project.cd hello_rust.src/main.rs in a text editor.
fn main() {
println!("Hello, World!");
}
cargo run.Hello, World! on the screen.Explanation: cargo new creates the project structure. cargo run compiles and runs your code. The main function is the starting point. println! prints text.
std::io at the top.let mut name = String::new();.io::stdin().read_line(&mut name)..expect("Failed").name.trim() to remove extra spaces.println!.cargo can run tests for your code automatically?let to create them.mut to make a variable changeable.mut.main() correctly.cargo check often to catch errors.cargo fmt.cargo test.
Your Code (main.rs)
|
V
Rust Compiler (rustc)
|
+--> Errors? --> Fix and recompile
|
V
Executable Program
|
V
Runs on your computer
my_project/
├── Cargo.toml (project settings)
└── src/
└── main.rs (your code)
Start
|
V
Need to change the value later?
|
+-- Yes --> Use let mut x = ...
|
+-- No --> Use let x = ...
|
V
End
Module One: Rust Foundations
|
V
Module Two: Control Flow and Ownership
|
V
Module Three: Custom Types and Error Handling
|
V
Module Four: Collections, Generics, and Traits
|
V
Module Five: Concurrency and Systems Programming
|
V
Module Six: Professional Rust and Capstone
|
V
Certified Rust Programming Expert 🎉
| Feature | Rust | Python | C++ |
|---|---|---|---|
| Speed | Very fast | Slower | Very fast |
| Memory safety | Yes, compiler checks | Automatic, but slower | Manual, error-prone |
| Learning curve | Moderate | Easy | Hard |
| Concurrency | Safe and easy | Limited | Hard |
| Use case | Systems, embedded, web | Scripts, data science | Games, systems |
| Property | Immutable | Mutable |
|---|---|---|
| Can change value? | No | Yes |
| Keyword | let | let mut |
| Safety | Higher | Lower, but flexible |
| Example | let x = 5; | let mut y = 5; y = 10; |
| Type | Category | Example |
|---|---|---|
| i32 | Integer | 42 |
| f64 | Floating point | 3.14 |
| bool | Boolean | true |
| String | Text | "Hello" |
| char | Character | 'A' |
Lesson 1: Systems programming controls hardware and supports apps. Rust is a great language for it.
Lesson 2: Rust is safe, fast, and concurrent. It prevents many crashes.
Lesson 3: Install Rust with rustup. You get rustc and cargo.
Lesson 4: “Hello, World!” prints a message. Every Rust program starts with fn main().
Lesson 5: Variables store data. Use let.
Lesson 6: Data types tell Rust what kind of value you have.
Lesson 7: Immutable by default. Use mut to change.
Lesson 8: Functions are reusable blocks of code.
Lesson 9: Comments are notes for humans.
Lesson 10: Printing shows text. Input reads what you type.
Lesson 11: The compiler checks your code and finds errors.
Lesson 12: Cargo manages projects and libraries.
Lesson 13: Common mistakes include missing semicolons and wrong types.
Lesson 14: Best practices make code clean and safe.
Lesson 15: Combine variables, functions, and input in a greeting program.
Congratulations! You have finished Module One of the Certified Rust Programming Expert course. You learned that systems programming is the foundation of all software. Rust is a modern language that is safe, fast, and perfect for systems. You installed Rust, wrote your first program, and learned about variables, data types, mutability, functions, comments, the compiler, Cargo, and input/output. You also saw many examples from Nigeria and everyday life. You now know common mistakes and best practices. Most importantly, you are ready to write simple Rust programs and understand how they work. Keep practising, and you will become a Certified Rust Programming Expert!
mut? To allow a variable to change. Rust defaults to safety.Match the word to its definition.
| Word | Definition |
|---|---|
| 1. Variable | A. A reusable block of code. |
| 2. Function | B. A named box that stores a value. |
| 3. Compiler | C. A note in code that the computer ignores. |
| 4. Comment | D. Turns code into a runnable program. |
| 5. Cargo | E. Rust’s project manager. |
Answers: 1-B, 2-A, 3-D, 4-C, 5-E
let mut score = 0;.std::io::stdin().read_line().let x = 5; x = 10; and get an error. Why? let mut x = 5;.Title: “Build a Greeting Robot”
Instructions: In groups of 3–4, write a Rust program that asks for each person’s name and then prints a greeting for each. Use a function for the greeting. One person types, one person reads the compiler errors, one person explains the code. Share your program with the class.
Goal: Practice variables, input, functions, and printing.
Task: Write a Rust program that stores your name, age, and favourite food in variables. Then print them in a sentence like: “My name is Ada, I am 13 years old, and I love jollof rice.”
Hint: Use let and println!.
Project: “My Daily Routine”
Write a Rust program that prints your daily routine. Use at least three functions: one for morning, one for afternoon, and one for evening. Call them in main(). Add comments to explain each part.
Example output:
Morning: Wake up, brush teeth, eat breakfast. Afternoon: Go to school, study, play. Evening: Do homework, eat dinner, sleep.
Assignment: Create a new Cargo project called about_me. In main.rs, write a program that:
Submit: Your main.rs file and a screenshot of the program running.
rustup and use cargo for projects.let and mut.println!, read input with stdin().read_line().In Module Two, we will dive deeper into Rust. We will learn about:
if, else, and match.loop, while, and for.To prepare, make sure you have completed the practical assignment and can run simple Rust programs. Review your notes on variables and functions. Bring your curiosity!
See you in Module Two!
End of Module One – Certified Rust Programming Expert